Submission #167015

# Submission time Handle Problem Language Result Execution time Memory
167015 2019-12-05T08:59:48 Z itgl Schools (IZhO13_school) C++14
20 / 100
414 ms 9456 KB
#include<bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define mp make_pair

using namespace std;

priority_queue<pair<int,pair<int,int> > > pq,pq1;
int main(){
  int n,m,s;
  cin >> n >> m >> s;

  for(int i=1;i<=n;i++){
    int x,y;
    cin >> x >> y;
    pq.push(mp(x-y,mp(x,y)));
  }
  int res=0;
  //cout << "==================\n";
  while(m--){
    //cout << pq.top().ss.ff << ' ' << pq.top().ss.ss << '\n';
    res+=pq.top().ss.ff;
    pq.pop();
  }
  //cout<<"====================\n";
  int k=pq.size();
  while(k--){
    pq1.push(mp(-pq.top().ff,mp(pq.top().ss.ff,pq.top().ss.ss)));
    pq.pop();
  }
  while(s--){
    //cout << pq1.top().ss.ff << ' ' << pq1.top().ss.ss << '\n';
    res+=pq1.top().ss.ss;
    pq1.pop();
  }

  cout <<res;


  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Incorrect 4 ms 376 KB Output isn't correct
6 Incorrect 2 ms 256 KB Output isn't correct
7 Incorrect 7 ms 504 KB Output isn't correct
8 Correct 7 ms 504 KB Output is correct
9 Incorrect 7 ms 504 KB Output isn't correct
10 Incorrect 8 ms 504 KB Output isn't correct
11 Incorrect 8 ms 504 KB Output isn't correct
12 Incorrect 8 ms 504 KB Output isn't correct
13 Incorrect 44 ms 1268 KB Output isn't correct
14 Incorrect 103 ms 3680 KB Output isn't correct
15 Incorrect 206 ms 6884 KB Output isn't correct
16 Incorrect 248 ms 7016 KB Output isn't correct
17 Incorrect 301 ms 7524 KB Output isn't correct
18 Incorrect 326 ms 7876 KB Output isn't correct
19 Incorrect 356 ms 8036 KB Output isn't correct
20 Incorrect 414 ms 9456 KB Output isn't correct