# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
89004 | 2018-12-10T08:05:25 Z | tarash117 | 학교 설립 (IZhO13_school) | C++14 | 648 ms | 10008 KB |
#include<bits/stdc++.h> using namespace std; struct abc{ int x; int i; }; bool ioni(abc a,abc b){ return b.x<=a.x; } int used1[3000001],used2[3000001]; int main(){ int n,m,s; cin>>n>>m>>s; abc a[n+1],b[n+1]; for(int i=1;i<=n;i++){ cin>>a[i].x>>b[i].x; a[i].i=i; b[i].i=i; } sort(a+1,a+1+n,ioni); sort(b+1,b+1+n,ioni); int mx1=0; for(int i=1;i<=m;i++){ mx1+=a[i].x; used1[a[i].i]++; } int j=1; for(int i=1;i<=n;i++){ if(j>s) break; if(used1[b[i].i]==0){ mx1+=b[i].x; j++; } } int mx2=0; for(int i=1;i<=s;i++){ mx2+=b[i].x; used2[b[i].i]++; } j=1; for(int i=1;i<=n;i++){ if(j>m) break; if(used2[a[i].i]==0){ mx2+=a[i].x; j++; } } cout<<max(mx1,mx2); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 504 KB | Output isn't correct |
2 | Correct | 2 ms | 520 KB | Output is correct |
3 | Correct | 2 ms | 548 KB | Output is correct |
4 | Incorrect | 2 ms | 548 KB | Output isn't correct |
5 | Incorrect | 2 ms | 548 KB | Output isn't correct |
6 | Incorrect | 2 ms | 548 KB | Output isn't correct |
7 | Incorrect | 6 ms | 668 KB | Output isn't correct |
8 | Incorrect | 6 ms | 668 KB | Output isn't correct |
9 | Incorrect | 6 ms | 668 KB | Output isn't correct |
10 | Incorrect | 6 ms | 668 KB | Output isn't correct |
11 | Incorrect | 6 ms | 668 KB | Output isn't correct |
12 | Incorrect | 6 ms | 668 KB | Output isn't correct |
13 | Incorrect | 35 ms | 1348 KB | Output isn't correct |
14 | Incorrect | 72 ms | 2380 KB | Output isn't correct |
15 | Correct | 149 ms | 3916 KB | Output is correct |
16 | Incorrect | 176 ms | 4928 KB | Output isn't correct |
17 | Incorrect | 491 ms | 5788 KB | Output isn't correct |
18 | Incorrect | 563 ms | 6276 KB | Output isn't correct |
19 | Incorrect | 648 ms | 6700 KB | Output isn't correct |
20 | Runtime error | 431 ms | 10008 KB | Execution killed with signal 7 (could be triggered by violating memory limits) |