#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<vector> #define db(a) cout << #a << " = " << a << endl; int board[500][500]; using namespace std; int main(){ int W, H, N, X1, Y1, X2, Y2, total; while(scanf("%d%d%d", &W, &H, &N)){ if(W == 0 && H == 0 && N == 0) break; total = W * H; for(int i = 0; i < H; i++) for(int j = 0; j < W; j++) board[i][j] = 1; for(int k = 0; k < N; k++){ scanf("%d%d%d%d", &X1, &Y1, &X2, &Y2); X1--, Y1--, X2--, Y2--; if(X1 > X2) swap(X1, X2); if(Y1 > Y2) swap(Y1, Y2); for(int i = Y1; i <= Y2; i++) for(int j = X1; j <= X2; j++) if(board[i][j]) board[i][j] = 0, total--; } if(total) if(total != 1) printf("There are %d empty spots.\n", total); else printf("There is one empty spot.\n"); else printf("There is no empty spots.\n"); } return 0; }
lunes, 24 de octubre de 2011
10703 - Free spots, uva
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario