# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49738 | IvanC | Karte (COCI18_karte) | C++17 | 188 ms | 10612 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |