-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10703.cpp
More file actions
35 lines (35 loc) · 953 Bytes
/
10703.cpp
File metadata and controls
35 lines (35 loc) · 953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <bits/stdc++.h>
using namespace std;
void swap(int* p, int* q) {
int* t;
*t = *p;
*p = *q;
*q = *p;
}
int main() {
bool a[510][510];
int i, j, x1, y1, sum, k, h, l, x, n, y;
while (scanf("%d %d %d", &k, &h, &n)) {
if (k == 0 && h == 0 && n == 0) return 0;
memset(a, 1, sizeof(a));
while (n--) {
scanf("%d%d%d%d", &x, &y, &x1, &y1);
if (x1 < x) swap(x, x1);
if (y1 < y) swap(y, y1);
for (i = x; i <= x1; i++)
for (j = y; j <= y1; j++) a[i][j] = 0;
}
sum = 0;
for (i = 1; i <= k; i++)
for (j = 1; j <= h; j++) {
if (a[i][j]) sum++;
}
if (sum == 0)
puts("There is no empty spots.");
else if (sum == 1)
puts("There is one empty spot.");
else
printf("There are %d empty spots.\n", sum);
}
return 0;
}