0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-24 00:28:48 +00:00

P1789 【Mc生存】插火把

R36511988
This commit is contained in:
Baoshuo Ren 2020-08-07 00:55:30 +08:00 committed by Baoshuo Ren
parent 36678134ca
commit da736e12d9
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

31
problem/P1789/P1789.cpp Normal file
View File

@ -0,0 +1,31 @@
#include <bits/stdc++.h>
using namespace std;
int n, m, k, x, y, o, p, ans = 0;
int dx1[13] = {2, 0, -2, 0, 1, 1, 1, 0, 0, 0, -1, -1, -1};
int dy1[13] = {0, 2, 0, -2, 0, 1, -1, 1, 0, -1, 0, 1, -1};
int dx2[25] = {-2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2};
int dy2[25] = {-2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0,
1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2};
int main() {
cin >> n >> m >> k;
int a[n + 5][n + 5];
memset(a, 0, sizeof(a));
for (int i = 1; i <= m; i++) {
cin >> x >> y;
for (int j = 0; j < 13; j++)
a[x + dx1[j]][y + dy1[j]] = 1;
}
for (int i = 1; i <= k; i++) {
cin >> o >> p;
for (int j = 0; j < 25; j++)
a[o + dx2[j]][p + dy2[j]] = 1;
}
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
if (a[i][j] == 0)
ans++;
cout << ans;
return 0;
}