Submission #17662

#TimeUsernameProblemLanguageResultExecution timeMemory
17662Namnamseo수족관 1 (KOI13_aqua1)C++14
100 / 100
17 ms1180 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...