#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
int n, m, k, a;
int cnt = 0;// 拿来计数
scanf_s("%d %d %d\n", &n, &m, &k); //m是火把数,k是萤石数,n是方块数
a = (n + 4) * (n + 4);
int** p;//p是总地图大小的数组
p = (int**)malloc(a * sizeof(int*));
p[n + 3][n + 3] = 0;//地图
for (int i = 0; i < m; i++) {
int b, c;//循环输入的火把坐标
scanf_s("%d %d", &b, &c);
int xb = b + 2;
int xc = c + 2;
p[xb][xc] = 1;
p[xb - 1][xc + 1] = 1;
p[xb - 1][xc + 1] = 1;
p[xb + 1][xc - 1] = 1;
p[xb + 1][xc + 1] = 1;
for (int j = 0; j < 5; j++) {
p[xb][xc + 2 - j] = 1;
}
for (int j = 0; j < 5; j++) {
p[xb + 2 - j][xc] = 1;
}
}
for (int i = 0; i < k; i++) {
int d, e;//循环输入的荧石坐标
scanf_s("%d %d ", &d, &e);
for (int j = 0; j < 5; j++) {
p[d - 2 + j][e] = 1;
for (int i = 0; i < 5; i++) {
p[d - 2 + j][e - 2 + i] = 1;
}
}
}
for (int i = 2; i < n + 2; i++)
for (int j = 2; j < n + 2; j++)
if (p[i][j] == 1)
cnt++;
printf("%d", n * n - cnt);
free(p);
return 0;
}
#include<math.h>
#include<stdlib.h>
int main()
{
int n, m, k, a;
int cnt = 0;// 拿来计数
scanf_s("%d %d %d\n", &n, &m, &k); //m是火把数,k是萤石数,n是方块数
a = (n + 4) * (n + 4);
int** p;//p是总地图大小的数组
p = (int**)malloc(a * sizeof(int*));
p[n + 3][n + 3] = 0;//地图
for (int i = 0; i < m; i++) {
int b, c;//循环输入的火把坐标
scanf_s("%d %d", &b, &c);
int xb = b + 2;
int xc = c + 2;
p[xb][xc] = 1;
p[xb - 1][xc + 1] = 1;
p[xb - 1][xc + 1] = 1;
p[xb + 1][xc - 1] = 1;
p[xb + 1][xc + 1] = 1;
for (int j = 0; j < 5; j++) {
p[xb][xc + 2 - j] = 1;
}
for (int j = 0; j < 5; j++) {
p[xb + 2 - j][xc] = 1;
}
}
for (int i = 0; i < k; i++) {
int d, e;//循环输入的荧石坐标
scanf_s("%d %d ", &d, &e);
for (int j = 0; j < 5; j++) {
p[d - 2 + j][e] = 1;
for (int i = 0; i < 5; i++) {
p[d - 2 + j][e - 2 + i] = 1;
}
}
}
for (int i = 2; i < n + 2; i++)
for (int j = 2; j < n + 2; j++)
if (p[i][j] == 1)
cnt++;
printf("%d", n * n - cnt);
free(p);
return 0;
}