Submission #13214

# Submission time Handle Problem Language Result Execution time Memory
13214 2015-02-03T08:30:11 Z dohyun0324 Schools (IZhO13_school) C++
0 / 100
126 ms 6636 KB
#include<stdio.h>
#include<queue>
#include<algorithm>
using namespace std;
int sum,dap,n,m,s,p,ch[300010],p2;
priority_queue<int>q;
priority_queue<int>q2;
struct data{
    int x,y;
    bool operator<(const data&r)const{
        return x>r.x;
    }
}a[300010];
int main()
{
    int i;
    scanf("%d %d %d",&n,&m,&s);
    for(i=1;i<=n;i++)
    {
        scanf("%d %d",&a[i].x,&a[i].y);
    }
    sort(a+1,a+n+1); p=m+s;
    for(i=n;i>=p+1;i--) q2.push(a[i].y);
    for(i=1;i<=m;i++) q.push(a[i].y-a[i].x), sum+=a[i].x;
    p2=m+1;
    for(i=1;i<=s;i++)
    {
        if(q.top()+a[p2].x<=q2.top())
        {
            sum+=q2.top(); p--;
            q2.pop(); q2.push(a[p+1].y);
        }
        else
        {
            sum+=q.top()+a[p2].x; p2++;
            q.pop();
        }
        if(dap<sum) dap=sum;
    }
    printf("%d",dap);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 5092 KB SIGSEGV Segmentation fault
2 Incorrect 0 ms 5096 KB Output isn't correct
3 Runtime error 0 ms 5092 KB SIGSEGV Segmentation fault
4 Incorrect 0 ms 5096 KB Output isn't correct
5 Incorrect 0 ms 5096 KB Output isn't correct
6 Incorrect 0 ms 5096 KB Output isn't correct
7 Incorrect 0 ms 5096 KB Output isn't correct
8 Runtime error 0 ms 5092 KB SIGSEGV Segmentation fault
9 Incorrect 0 ms 5096 KB Output isn't correct
10 Incorrect 0 ms 5096 KB Output isn't correct
11 Incorrect 0 ms 5096 KB Output isn't correct
12 Incorrect 2 ms 5096 KB Output isn't correct
13 Incorrect 13 ms 5240 KB Output isn't correct
14 Incorrect 33 ms 5484 KB Output isn't correct
15 Incorrect 60 ms 6636 KB Output isn't correct
16 Runtime error 75 ms 5224 KB SIGSEGV Segmentation fault
17 Incorrect 103 ms 6000 KB Output isn't correct
18 Incorrect 92 ms 6636 KB Output isn't correct
19 Incorrect 126 ms 6128 KB Output isn't correct
20 Incorrect 104 ms 6636 KB Output isn't correct