Submission #3246169


Source Code Expand

#include<iostream>
#include<string>
#include<vector>
#include<stdbool.h>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<set>
#include<string>
#include<stdlib.h>
typedef long long ll;
using namespace std;

//stringの使い方
int main(void) {
	int w, h, n;
	cin >> w >> h >> n;
	int xmax = w, xmin = 0, ymax = h, ymin = 0;
	int x, y, a;
	for (int i = 0;i < n;i++) {
		cin >> x >> y >> a;
		if (a == 1) {
			if (xmin <= x) {
				xmin = x;
			}
		}
		if (a == 2) {
			if (x <= xmax) {
				xmax = x;
			}
		}
		if (a == 3) {
			if (ymin <= y) {
				ymin = y;
			}
		}
		if (a == 4) {
			if (y <= ymax) {
				ymax = y;
			}
		}
	}
	if (xmax - xmin <= 0 || ymax - ymin <= 0)cout << 0 << endl;
	else cout << (xmax - xmin)*(ymax - ymin) << endl;
	return 0;
}

Submission Info

Submission Time
Task B - Snuke's Coloring 2 (ABC Edit)
User hanbeidayo
Language C++14 (GCC 5.4.1)
Score 200
Code Size 813 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 13
Set Name Test Cases
sample sample_01.txt, sample_02.txt, sample_03.txt
All dir_01.txt, dir_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, sample_01.txt, sample_02.txt, sample_03.txt, small_01.txt, small_02.txt, small_03.txt, small_04.txt
Case Name Status Exec Time Memory
dir_01.txt AC 1 ms 256 KB
dir_02.txt AC 1 ms 256 KB
random_01.txt AC 1 ms 256 KB
random_02.txt AC 1 ms 256 KB
random_03.txt AC 1 ms 256 KB
random_04.txt AC 1 ms 256 KB
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
small_01.txt AC 1 ms 256 KB
small_02.txt AC 1 ms 256 KB
small_03.txt AC 1 ms 256 KB
small_04.txt AC 1 ms 256 KB