Submission #933120

# Submission time Handle Problem Language Result Execution time Memory
933120 2024-02-25T06:26:19 Z imarn Schools (IZhO13_school) C++14
15 / 100
2000 ms 21424 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++;
        }
    }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 4440 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 Execution timed out 2047 ms 4700 KB Time limit exceeded
9 Incorrect 3 ms 4956 KB Output isn't correct
10 Incorrect 2 ms 4700 KB Output isn't correct
11 Incorrect 2 ms 4952 KB Output isn't correct
12 Incorrect 2 ms 4956 KB Output isn't correct
13 Incorrect 12 ms 8452 KB Output isn't correct
14 Incorrect 20 ms 10084 KB Output isn't correct
15 Correct 35 ms 14312 KB Output is correct
16 Execution timed out 2060 ms 15012 KB Time limit exceeded
17 Incorrect 88 ms 15772 KB Output isn't correct
18 Incorrect 76 ms 16300 KB Output isn't correct
19 Incorrect 94 ms 17316 KB Output isn't correct
20 Incorrect 122 ms 21424 KB Output isn't correct