# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49738 | 2018-06-02T13:20:40 Z | IvanC | Karte (COCI18_karte) | C++17 | 188 ms | 10612 KB |
#include <bits/stdc++.h> using namespace std; vector<int> V,U; int N,K,F,copia; int main(){ scanf("%d %d",&N,&K); copia = K; for(int i = 1;i<=N;i++){ int a; scanf("%d",&a); V.push_back(a); } sort(V.begin(),V.end()); while(copia > 0){ if(V.empty()){ printf("-1\n"); return 0; } copia--; U.push_back(V.back()); V.pop_back(); } reverse(U.begin(),U.end()); for(int i : V){ U.push_back(i); } for(int i : U){ if(F < i){ F++; } } if(F != K) printf("-1\n"); else{ reverse(U.begin(),U.end()); for(int i : U) printf("%d ",i); printf("\n"); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 432 KB | Output is correct |
2 | Correct | 2 ms | 508 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 628 KB | Output is correct |
2 | Correct | 2 ms | 628 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 628 KB | Output is correct |
2 | Correct | 3 ms | 628 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 628 KB | Output is correct |
2 | Correct | 3 ms | 636 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 692 KB | Output is correct |
2 | Correct | 3 ms | 716 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 736 KB | Output is correct |
2 | Correct | 3 ms | 736 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 39 ms | 2148 KB | Output is correct |
2 | Correct | 30 ms | 2408 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 70 ms | 4052 KB | Output is correct |
2 | Correct | 56 ms | 4816 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 188 ms | 9096 KB | Output is correct |
2 | Correct | 117 ms | 10612 KB | Output is correct |