Submission #18116

# Submission time Handle Problem Language Result Execution time Memory
18116 2016-01-21T10:18:49 Z comet Schools (IZhO13_school) C++
25 / 100
190 ms 22656 KB
#include <cstdio>
#include <queue>
#include <algorithm>

using namespace std;
typedef long long ll;
typedef pair<ll,ll> pp;

int N,M,S;
ll a[300010],b[300010];

priority_queue <pp> Q1,Q2;

int main(){

	scanf("%d%d%d",&N,&M,&S);

	for(int i=0;i<N;i++){
		scanf("%lld%lld",&a[i],&b[i]);
	}

	ll sum=0;

	for(int i=0;i<N;i++){
		sum+=a[i];
		Q1.push(pp(b[i]-a[i],i));
	}

	for(int i=0;i<N-M;i++){
		ll v=Q1.top().second;Q1.pop();
		sum+=b[v]-a[v];
		Q2.push(pp(-b[v],i));
	}

	for(int i=0;i<N-M-S;i++){
		ll t=Q2.top().first;Q2.pop();
		sum+=t;
	}

	printf("%lld\n",sum);

}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 6268 KB Output is correct
2 Correct 0 ms 6268 KB Output is correct
3 Correct 0 ms 6268 KB Output is correct
4 Incorrect 0 ms 6268 KB Output isn't correct
5 Incorrect 0 ms 6268 KB Output isn't correct
6 Incorrect 0 ms 6268 KB Output isn't correct
7 Incorrect 0 ms 6400 KB Output isn't correct
8 Correct 0 ms 6400 KB Output is correct
9 Incorrect 0 ms 6400 KB Output isn't correct
10 Incorrect 0 ms 6400 KB Output isn't correct
11 Incorrect 0 ms 6532 KB Output isn't correct
12 Incorrect 3 ms 6532 KB Output isn't correct
13 Incorrect 13 ms 7808 KB Output isn't correct
14 Incorrect 55 ms 12416 KB Output isn't correct
15 Incorrect 110 ms 18560 KB Output isn't correct
16 Correct 100 ms 18560 KB Output is correct
17 Incorrect 113 ms 18560 KB Output isn't correct
18 Incorrect 114 ms 18560 KB Output isn't correct
19 Incorrect 127 ms 18560 KB Output isn't correct
20 Incorrect 190 ms 22656 KB Output isn't correct