답안 #89096

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
89096 2018-12-10T09:56:08 Z lazarus88 학교 설립 (IZhO13_school) C++14
5 / 100
2000 ms 24852 KB
#include<bits/stdc++.h>
using namespace  std;
int main(){
	int n,m,s,cnt=0;
	set <pair<int,int > > st1;
	set< pair< int,pair <int ,int> > > st;
	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],{-b[i],i}});
       st1.insert({-b[i],i});
   }
   while(m>0){
   	pair<int,pair<int,int> > k=*st.begin();
   	st.erase(st.begin());
   	pair<int,pair<int,int> > t=*st.begin();
   	if(-k.first+b[t.second.second]>-t.first+b[k.second.second]){
   		cnt+=(-k.first);
   		st1.erase({-b[k.second.second],k.second.second});
	   }
	   else{
	   	st.erase(st.begin());
	   	st.insert(k);
	   	cnt+=(-t.first);
	   	st1.erase({-b[t.second.second],t.second.second});
	   }
	   m--;
   }
   while(s>0){
   	pair<int,int > k=*st1.begin();
   	
   	st1.erase(st1.begin());
   	cnt+=(-k.first);
   	s--;
   }
      cout<<cnt;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Execution timed out 2033 ms 372 KB Time limit exceeded
3 Correct 2 ms 536 KB Output is correct
4 Incorrect 2 ms 536 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 8 ms 1032 KB Output isn't correct
8 Incorrect 9 ms 1072 KB Output isn't correct
9 Incorrect 10 ms 1072 KB Output isn't correct
10 Incorrect 10 ms 1072 KB Output isn't correct
11 Incorrect 9 ms 1072 KB Output isn't correct
12 Incorrect 9 ms 1128 KB Output isn't correct
13 Incorrect 94 ms 4844 KB Output isn't correct
14 Incorrect 199 ms 9724 KB Output isn't correct
15 Runtime error 237 ms 24448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 244 ms 24472 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 241 ms 24852 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 248 ms 24852 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 241 ms 24852 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 228 ms 24852 KB Execution killed with signal 11 (could be triggered by violating memory limits)