Submission #17662

# Submission time Handle Problem Language Result Execution time Memory
17662 2016-01-08T00:17:48 Z Namnamseo 수족관 1 (KOI13_aqua1) C++14
100 / 100
17 ms 1180 KB
#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
1 Correct 0 ms 1180 KB Output is correct
2 Correct 0 ms 1180 KB Output is correct
3 Correct 0 ms 1180 KB Output is correct
4 Correct 0 ms 1180 KB Output is correct
5 Correct 0 ms 1180 KB Output is correct
6 Correct 0 ms 1180 KB Output is correct
7 Correct 0 ms 1180 KB Output is correct
8 Correct 0 ms 1180 KB Output is correct
9 Correct 0 ms 1180 KB Output is correct
10 Correct 0 ms 1180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1180 KB Output is correct
2 Correct 0 ms 1180 KB Output is correct
3 Correct 0 ms 1180 KB Output is correct
4 Correct 0 ms 1180 KB Output is correct
5 Correct 0 ms 1180 KB Output is correct
6 Correct 0 ms 1180 KB Output is correct
7 Correct 0 ms 1180 KB Output is correct
8 Correct 0 ms 1180 KB Output is correct
9 Correct 0 ms 1180 KB Output is correct
10 Correct 0 ms 1180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1180 KB Output is correct
2 Correct 0 ms 1180 KB Output is correct
3 Correct 1 ms 1180 KB Output is correct
4 Correct 0 ms 1180 KB Output is correct
5 Correct 0 ms 1180 KB Output is correct
6 Correct 0 ms 1180 KB Output is correct
7 Correct 0 ms 1180 KB Output is correct
8 Correct 0 ms 1180 KB Output is correct
9 Correct 0 ms 1180 KB Output is correct
10 Correct 0 ms 1180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1180 KB Output is correct
2 Correct 9 ms 1180 KB Output is correct
3 Correct 13 ms 1180 KB Output is correct
4 Correct 17 ms 1180 KB Output is correct
5 Correct 11 ms 1180 KB Output is correct
6 Correct 9 ms 1180 KB Output is correct
7 Correct 14 ms 1180 KB Output is correct
8 Correct 5 ms 1180 KB Output is correct
9 Correct 9 ms 1180 KB Output is correct
10 Correct 4 ms 1180 KB Output is correct