This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <algorithm>
#define x first
#define y second
using namespace std;
typedef pair<int,int> pp;
pp data[5010];
int maxh[5010];
pp chk[5010];
int n;
int main()
{
scanf("%d",&n);
int i,j,k;
for(i=0;i<n;++i) scanf("%d%d",&data[i].x, &data[i].y);
scanf("%d",&k);
int a,b,c;
int l,r,cur;
for(i=0;i<k;++i) {
scanf("%d%d%*d%*d",&a,&b);
for(c=0;c<n;++c) if(data[c].x==a && data[c].y==b) break;
cur=b;
for(l=c-2;0<=l;l-=2){
cur=min(cur,data[l].y);
maxh[l]=max(maxh[l],cur);
}
cur=b;
for(r=c+2;r<n;r+=2){
cur=min(cur,data[r].y);
maxh[r]=max(maxh[r],cur);
}
maxh[c]=b;
}
int ans=0;
for(i=1;i<n;i+=2){
ans+=(data[i+1].x-data[i].x)*(data[i].y-maxh[i]);
}
printf("%d\n",ans);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |