Submission #3245923


Source Code Expand

#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
	int xx, yy, n;
	int x[120], y[120], a[120];
	while(~scanf("%d %d %d", &xx, &yy, &n))
	{
		int i;
		int ans = 0;
		int x1 = 0, x2 = xx, y1 = 0, y2 = yy;
		for(i = 0; i < n; i++)
		{
			scanf("%d %d %d", &x[i], &y[i], &a[i]);
			if(a[i] == 1)
			x1 = max(x1, x[i]);
			if(a[i] == 2)
			x2 = min(x2, x[i]);
			if(a[i] == 3)
			y1 = max(y1, y[i]);
			if(a[i] == 4)
			y2 = min(y2, y[i]);
		}
		ans = (x2 - x1) * (y2 - y1);
		if((x1 >= x2) || (y1 >= y2)) ans = 0;
		printf("%d\n", ans);
	}

}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:15:42: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d %d %d", &x[i], &y[i], &a[i]);
                                          ^

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