-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path202206-2.cpp
55 lines (55 loc) · 1.35 KB
/
202206-2.cpp
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, L, S;
scanf("%d%d%d", &n, &L, &S);
vector<int> px(n), py(n);
for (int i = 0; i < n; i++) {
scanf("%d%d", &px[i], &py[i]);
}
vector<int> px1, py1;
int num = 0;
for (int i = 0; i < S + 1; i++) {
for (int j = 0; j < S + 1; j++) {
int t;
scanf("%d", &t);
if (t) {
px1.push_back(S - i);
py1.push_back(j);
num++;
}
}
}
int ans = 0;
for (int i = 0; i < n; i++) {
int x0 = px[i], y0 = py[i];
if (x0 + S > L || y0 + S > L) {
continue;
}
int flag = 0;
for (int j = 0; j < num; j++) {
int x1 = px1[j] + x0, y1 = py1[j] + y0;
int flag1 = 1;
for (int k = 0; k < n; k++) {
if (px[k] == x1 && py[k] == y1) {
flag1 = 0;
break;
}
}
if (flag1) {
flag = 1;
break;
}
}
if (flag) {
continue;
}
int num1 = 0;
for (int j = 0; j < n; j++) {
num1 += px[j] >= x0 && px[j] <= x0 + S && py[j] >= y0 && py[j] <= y0 + S;
}
ans += num1 == num;
}
printf("%d\n", ans);
}