//\\__ hr1212 __//\\
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mi;
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%lld\n",a)
#define nl printf("\n");
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define f(i,a,b) for(i=a;i<b;i++)
#define rf(i,a,b) for(i=a;i>=b;i--)
#define clr(x,a) memset(x,a,sizeof(x))
#define MAX 1000100
#define MOD 1000000007
int n,m,a[200][200];
int main(){
int r,k,i,c=0,x=0,y=0,j,t,l,z,x1=0,y1=0;
ll ans=0;string p;
si(t);
while(t--){
si(n);
si(m);
clr(a,0);
while(m--){
sii(x,y);sii(x1,y1);
x--;y--;x1;y1;
f(i,x,x1){
f(j,y,y1){
a[i][j]=1;
}
}
}
f(i,0,n){
f(j,0,n){
if(i-1>=0)
a[i][j]+=a[i-1][j];
if(j-1>=0)
a[i][j]+=a[i][j-1];
if(i-1>=0 && j-1>=0)
a[i][j]-=a[i-1][j-1];
}
}
ans=0;
f(i,0,n){
f(j,0,n){
f(l,i,n){
f(r,j,n){
z=a[l][r];
if(i-1>=0)
z-=a[i-1][r];
if(j-1>=0)
z-=a[l][j-1];
if(i-1>=0 && j-1>=0)
z+=a[i-1][j-1];
if(z==0)
ans=max(ans,(ll)(l-i+1)*(r-j+1));
}
}
}
}
pi(ans);
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mi;
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%lld\n",a)
#define nl printf("\n");
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define f(i,a,b) for(i=a;i<b;i++)
#define rf(i,a,b) for(i=a;i>=b;i--)
#define clr(x,a) memset(x,a,sizeof(x))
#define MAX 1000100
#define MOD 1000000007
int n,m,a[200][200];
int main(){
int r,k,i,c=0,x=0,y=0,j,t,l,z,x1=0,y1=0;
ll ans=0;string p;
si(t);
while(t--){
si(n);
si(m);
clr(a,0);
while(m--){
sii(x,y);sii(x1,y1);
x--;y--;x1;y1;
f(i,x,x1){
f(j,y,y1){
a[i][j]=1;
}
}
}
f(i,0,n){
f(j,0,n){
if(i-1>=0)
a[i][j]+=a[i-1][j];
if(j-1>=0)
a[i][j]+=a[i][j-1];
if(i-1>=0 && j-1>=0)
a[i][j]-=a[i-1][j-1];
}
}
ans=0;
f(i,0,n){
f(j,0,n){
f(l,i,n){
f(r,j,n){
z=a[l][r];
if(i-1>=0)
z-=a[i-1][r];
if(j-1>=0)
z-=a[l][j-1];
if(i-1>=0 && j-1>=0)
z+=a[i-1][j-1];
if(z==0)
ans=max(ans,(ll)(l-i+1)*(r-j+1));
}
}
}
}
pi(ans);
}
return 0;
}
No comments:
Post a Comment