Submission #342784

# Submission time Handle Problem Language Result Execution time Memory
342784 2021-01-02T19:55:48 Z Gurban Schools (IZhO13_school) C++17
25 / 100
111 ms 12768 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

const int maxn=3e5+5;
int n,s[2],a[maxn],b[maxn];
int vis[maxn];
vector<pair<int,pair<int,int>>>v;
ll ans;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> n >> s[0] >> s[1];
	for(int i = 1;i <= n;i++){
		cin >> a[i] >> b[i];
		v.push_back({a[i]-b[i],{a[i],i}});
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	for(int i = 0;i < s[0];i++) ans += v[i].second.first,vis[v[i].second.second]=1;
	vector<int>nw;
	for(int i = 1;i <= n;i++){
		if(vis[i]) continue;
		nw.push_back(b[i]);
	}
	sort(nw.begin(),nw.end());
	reverse(nw.begin(),nw.end());
	for(int i = 0;i < s[1];i++) ans += nw[i];
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 380 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Incorrect 1 ms 364 KB Output isn't correct
7 Incorrect 2 ms 620 KB Output isn't correct
8 Correct 2 ms 620 KB Output is correct
9 Incorrect 2 ms 620 KB Output isn't correct
10 Incorrect 2 ms 620 KB Output isn't correct
11 Incorrect 2 ms 620 KB Output isn't correct
12 Incorrect 2 ms 620 KB Output isn't correct
13 Incorrect 12 ms 1896 KB Output isn't correct
14 Incorrect 30 ms 3808 KB Output isn't correct
15 Incorrect 65 ms 7184 KB Output isn't correct
16 Correct 73 ms 8156 KB Output is correct
17 Incorrect 79 ms 9564 KB Output isn't correct
18 Incorrect 87 ms 10460 KB Output isn't correct
19 Incorrect 94 ms 11248 KB Output isn't correct
20 Incorrect 111 ms 12768 KB Output isn't correct