Submission #89090

# Submission time Handle Problem Language Result Execution time Memory
89090 2018-12-10T09:46:31 Z lazarus88 Schools (IZhO13_school) C++14
5 / 100
2000 ms 21560 KB
#include<bits/stdc++.h>
using namespace  std;
int main(){
	int n,m,s,cnt=0,cnt1=0,p,q;
	set <pair<int,int > > st,st1;
	cin>>n>>m>>s;
    int a[100001],b[100001];
	for(int  i=1;i<=n;i++){
       cin>>a[i]>>b[i];
       st.insert({-a[i],i});
       st1.insert({-b[i],i});
   }
   while(m>0){
   	pair<int,int> k=*st.begin();
   	st.erase(st.begin());
   	pair<int,int> t=*st.begin();
   	if(-k.first+b[t.second]>-t.first+b[k.second]){
   		cnt+=(-k.first);
   		st1.erase({-b[k.second],k.second});
	   }
	   else{
	   	st.erase(st.begin());
	   	st.insert(k);
	   	cnt+=(-t.first);
	   	st1.erase({-b[t.second],t.second});
	   }
	   m--;
   }
   while(s>0){
   	pair<int,int > k=*st1.begin();
   	
   	st1.erase(st1.begin());
   	cnt+=(-k.first);
   	s--;
   }
      cout<<cnt;
}

Compilation message

school.cpp: In function 'int main()':
school.cpp:4:18: warning: unused variable 'cnt1' [-Wunused-variable]
  int n,m,s,cnt=0,cnt1=0,p,q;
                  ^~~~
school.cpp:4:25: warning: unused variable 'p' [-Wunused-variable]
  int n,m,s,cnt=0,cnt1=0,p,q;
                         ^
school.cpp:4:27: warning: unused variable 'q' [-Wunused-variable]
  int n,m,s,cnt=0,cnt1=0,p,q;
                           ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Execution timed out 2061 ms 500 KB Time limit exceeded
3 Correct 2 ms 500 KB Output is correct
4 Incorrect 2 ms 528 KB Output isn't correct
5 Incorrect 2 ms 536 KB Output isn't correct
6 Incorrect 2 ms 536 KB Output isn't correct
7 Incorrect 9 ms 1024 KB Output isn't correct
8 Incorrect 9 ms 1024 KB Output isn't correct
9 Incorrect 10 ms 1024 KB Output isn't correct
10 Incorrect 10 ms 1024 KB Output isn't correct
11 Incorrect 8 ms 1024 KB Output isn't correct
12 Incorrect 8 ms 1024 KB Output isn't correct
13 Incorrect 72 ms 4188 KB Output isn't correct
14 Incorrect 179 ms 8676 KB Output isn't correct
15 Runtime error 220 ms 21236 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 225 ms 21404 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 202 ms 21404 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 205 ms 21404 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 205 ms 21560 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 216 ms 21560 KB Execution killed with signal 11 (could be triggered by violating memory limits)