# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
143200 | 2019-08-13T10:46:50 Z | Shelby | Karte (COCI18_karte) | C++11 | 32 ms | 1340 KB |
#include <bits/stdc++.h> #define MAXN 100000 using namespace std; int a[MAXN]; int check(int n) { int br=0,an=0; for(int i=n-1;i>=0;i--) { if(a[i]>=br) { an++; br++; } } return an; } void ispisi(int n) { for(int i=0;i<n;i++) printf("%d ",a[i]); } int main() { int n,i,k,cnt,dif; scanf("%d%d",&n,&k); for(i=0;i<n;i++) scanf("%d",&a[i]); sort(a,a+n); reverse(a+n-k,a+n); dif=check(n); if(dif!=k) printf("-1\n"); else ispisi(n); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 1272 KB | Output is correct |
2 | Correct | 23 ms | 1340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 16 ms | 760 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 16 ms | 632 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |