Submission #73801

# Submission time Handle Problem Language Result Execution time Memory
73801 2018-08-29T04:27:36 Z 노영훈(#2275) Schools (IZhO13_school) C++11
0 / 100
4 ms 440 KB
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
const int MX=300010;

int n, A[MX], B[MX], m, s;
vector<pii> X; vector<int> Y;
long long ans;

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	cin>>n>>m>>s;
	for(int i=1; i<=n; i++) cin>>A[i]>>B[i];
	for(int i=1; i<=n; i++) ans+=A[i];
	for(int i=1; i<=n; i++) X.push_back({B[i]-A[i], -B[i]});
	sort(X.begin(), X.end(), greater<pii>());
	for(int i=0; i<n-m; i++){
		ans+=X[i].first;
		Y.push_back(X[i].second);
	}
	sort(Y.begin(), Y.end(), greater<int>());
	for(int i=0; i<n-m-s; i++) ans+=Y[i];
	cout<<ans<<'\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 440 KB Output is correct
3 Correct 2 ms 440 KB Output is correct
4 Incorrect 3 ms 440 KB Output isn't correct
5 Halted 0 ms 0 KB -