# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
89002 | 2018-12-10T08:02:22 Z | tarash117 | Schools (IZhO13_school) | C++14 | 2000 ms | 10124 KB |
#include<bits/stdc++.h> using namespace std; struct abc{ int x; int i; }; bool ioni(abc a,abc b){ return a.x<=b.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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 348 KB | Output isn't correct |
2 | Correct | 2 ms | 468 KB | Output is correct |
3 | Incorrect | 2 ms | 584 KB | Output isn't correct |
4 | Incorrect | 2 ms | 584 KB | Output isn't correct |
5 | Incorrect | 2 ms | 584 KB | Output isn't correct |
6 | Incorrect | 2 ms | 584 KB | Output isn't correct |
7 | Incorrect | 6 ms | 620 KB | Output isn't correct |
8 | Incorrect | 6 ms | 620 KB | Output isn't correct |
9 | Incorrect | 6 ms | 620 KB | Output isn't correct |
10 | Incorrect | 7 ms | 660 KB | Output isn't correct |
11 | Incorrect | 6 ms | 660 KB | Output isn't correct |
12 | Incorrect | 6 ms | 660 KB | Output isn't correct |
13 | Incorrect | 35 ms | 1336 KB | Output isn't correct |
14 | Incorrect | 72 ms | 2384 KB | Output isn't correct |
15 | Incorrect | 149 ms | 3792 KB | Output isn't correct |
16 | Incorrect | 176 ms | 4936 KB | Output isn't correct |
17 | Runtime error | 1425 ms | 7520 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
18 | Execution timed out | 2029 ms | 7868 KB | Time limit exceeded |
19 | Execution timed out | 2021 ms | 8124 KB | Time limit exceeded |
20 | Runtime error | 407 ms | 10124 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |