# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
933122 |
2024-02-25T06:26:51 Z |
imarn |
Schools (IZhO13_school) |
C++14 |
|
104 ms |
20528 KB |
#include<bits/stdc++.h>
//#include "game.h"
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vvi vector<vi>
#define vp vector<pii>
using namespace std;
const int N=3e5+5;
ll a[N],b[N],vis[N]{0};
priority_queue<pair<ll,int>>aa,bb;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int n,m,s;cin>>n>>m>>s;
for(int i=0;i<n;i++)cin>>a[i]>>b[i],aa.push({a[i],i}),bb.push({b[i],i});
int x=m;ll tt=0;while(x--)tt+=aa.top().f,vis[aa.top().s]=1,aa.pop();x=s;
while(x--){
if(!vis[bb.top().s])tt+=bb.top().f,vis[bb.top().s]=1,bb.pop();
else{
if(bb.top().f+aa.top().f>a[bb.top().s])tt+=bb.top().f+aa.top().f-a[bb.top().s],vis[aa.top().s]=1,vis[bb.top().s]=1,bb.pop(),aa.pop();
else x++,bb.pop();
}
}cout<<tt;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4444 KB |
Output isn't correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Incorrect |
1 ms |
4444 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
4444 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
4444 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
4700 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
4700 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
4700 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
4700 KB |
Output isn't correct |
11 |
Incorrect |
2 ms |
4700 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
4700 KB |
Output isn't correct |
13 |
Incorrect |
11 ms |
8136 KB |
Output isn't correct |
14 |
Incorrect |
20 ms |
9488 KB |
Output isn't correct |
15 |
Correct |
30 ms |
12208 KB |
Output is correct |
16 |
Incorrect |
68 ms |
12720 KB |
Output isn't correct |
17 |
Incorrect |
75 ms |
13740 KB |
Output isn't correct |
18 |
Incorrect |
74 ms |
14952 KB |
Output isn't correct |
19 |
Incorrect |
96 ms |
15496 KB |
Output isn't correct |
20 |
Incorrect |
104 ms |
20528 KB |
Output isn't correct |