# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
89016 | 2018-12-10T08:18:59 Z | tarash117 | Schools (IZhO13_school) | C++14 | 648 ms | 10416 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[300001],used2[300001]; 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 | 380 KB | Output isn't correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
3 | Correct | 3 ms | 512 KB | Output is correct |
4 | Incorrect | 3 ms | 512 KB | Output isn't correct |
5 | Incorrect | 2 ms | 628 KB | Output isn't correct |
6 | Incorrect | 2 ms | 628 KB | Output isn't correct |
7 | Incorrect | 6 ms | 756 KB | Output isn't correct |
8 | Incorrect | 6 ms | 756 KB | Output isn't correct |
9 | Incorrect | 4 ms | 756 KB | Output isn't correct |
10 | Incorrect | 6 ms | 756 KB | Output isn't correct |
11 | Incorrect | 6 ms | 756 KB | Output isn't correct |
12 | Incorrect | 6 ms | 756 KB | Output isn't correct |
13 | Incorrect | 36 ms | 1476 KB | Output isn't correct |
14 | Incorrect | 71 ms | 2372 KB | Output isn't correct |
15 | Correct | 150 ms | 3780 KB | Output is correct |
16 | Incorrect | 177 ms | 4768 KB | Output isn't correct |
17 | Runtime error | 374 ms | 7696 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
18 | Incorrect | 563 ms | 9708 KB | Output isn't correct |
19 | Incorrect | 648 ms | 10416 KB | Output isn't correct |
20 | Runtime error | 397 ms | 10416 KB | Execution killed with signal 7 (could be triggered by violating memory limits) |