#include int width, height, queens; char pole[20000][20000]; int i, j; int max(int a, int b) { return (a > b)? a : b; } void zaznacit(int Qx, int Qy) { for (i = 0; i < width; i++) pole[i][Qy] = 1; for (i = 0; i < height; i++) pole[Qx][i] = 1; int status = 1; for (i = 0; i <= max(width, height); i++) { status = 0; if (Qx - i >= 0 && Qy - i >= 0) { pole[Qx - i][Qy - i] = 1; status = 1; } if (Qx + i < width && Qy - i >= 0) { pole[Qx + i][Qy - i] = 1; status = 1; } if (Qx + i < width && Qy + i < height) { pole[Qx + i][Qy + i] = 1; status = 1; } if (Qx - i >= 0 && Qy + i < height) { pole[Qx - i][Qy + i] = 1; status = 1; } if (status == 0) break; } } int main(void) { int counter = 0; int Qx, Qy; int k; scanf("%d %d %d\n", &width, &height, &queens); for (k = 0; k < queens; k++) { scanf("%d %d\n", &Qx, &Qy); Qx--; Qy--; /*if (strcmp("0 0 0", in) == 0) break;*/ zaznacit(Qx, Qy); } for (i = 0; i < width; i++) { for (j = 0; j < height; j++) { if (pole[i][j] == 0) counter++; /*printf("%d ", pole[i][j]);*/ } /*printf("\n");*/ } printf("%d\n", counter); return 0; }