Submission #2094597


Source Code Expand

#include<algorithm>
#include<array>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<iso646.h>
#include<queue>
#include<stack>
#include<string>
#include<vector>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

#define FOR(counter,initial_value,condition) for(int counter = initial_value; counter < condition;counter++)


int main()
{
	int w, h, n;
	vector<int> a;
	vector<int> x;
	vector<int> y;
	cin >> w >> h >> n;
	a.resize(n);
	x.resize(n);
	y.resize(n);
	fill(a.begin(), a.end(), 0);
	fill(x.begin(), x.end(), 0);
	fill(y.begin(), y.end(), 0);
	FOR(i, 0, n) {
		cin >> x[i] >> y[i] >> a[i];
	}
	int left=0, right=w, bot=0, top=h;
	FOR(i, 0, n) {
		if (a[i] == 1) {
			left = std::max(left, x[i]);
		}
		if (a[i] == 2) {
			right = std::min(right, x[i]);
		}
		if (a[i] == 3) {
			bot = std::max(bot, y[i]);
		}
		if (a[i] == 4) {
			top = std::min(top, y[i]);
		}
	}
	if (right - left < 0 or top - bot < 0) {
		cout << 0 << endl;
		return 0;
	}
	cout << (right - left)*(top - bot) << endl;
}

Submission Info

Submission Time
Task B - Snuke's Coloring 2 (ABC Edit)
User hr0499ctf
Language C++14 (GCC 5.4.1)
Score 200
Code Size 1108 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