#include<iostream> #include<cstdio> #include<cstring> #define db(a) cout << #a << " = " << a << endl #define db2(a, b) cout << #a << " = " << a << " " << #b << " = " << b << endl #define db3(a, b, c) cout << #a << " = " << a << " " << #b << " = " << b << " " << #c << " = " << c << endl using namespace std; int main() { #ifdef dennisbot freopen("in.in", "r", stdin); //freopen("ou.out", "w", stdout); #endif int p, s, b, r1, c1, r2, c2, matriz[101][101], fila[101], max, sum; scanf("%d", &p); for (;p; p--) { scanf("%d", &s); for (int i = 0; i < s; i++) for (int j = 0; j < s; j++) matriz[i][j] = 1; scanf("%d", &b); for (int k = 0; k < b; k++) { scanf("%d%d%d%d", &r1, &c1, &r2, &c2); r1--, c1--, r2--, c2--; for (int i = r1; i <= r2; i++) { for (int j = c1; j <= c2; j++) { matriz[i][j] = 0; } } } max = 0; for (int i = 0; i < s; i++) { for(int k = 0; k < s; k++) fila[k] = 0; for (int ii = i; ii < s; ii++) { sum = 0; for (int j = 0; j < s; j++) { fila[j] += matriz[ii][j]; if (fila[j] == ii - i + 1) sum += fila[j]; else sum = 0; if (sum > max) max = sum; } } } printf("%d\n", max); } return 0; }
jueves, 15 de marzo de 2012
10667 - Largest Block, uva
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario