Submission #143202

# Submission time Handle Problem Language Result Execution time Memory
143202 2019-08-13T10:48:30 Z Shelby Karte (COCI18_karte) C++11
120 / 120
136 ms 7164 KB
#include <bits/stdc++.h>
 
using namespace::std;
 
int n,k,i,x;
vector <int> v;
 
bool proveri(){
int br=0;
for(i=v.size()-1;i>=0;i--){
    if(v[i]>br) br++;
}
return br==k;
}
 
int main(){
std::ios_base::sync_with_stdio(0);
cin>>n>>k;
for(i=0;i<n;i++){
    cin>>x;
    v.push_back(x);
}
sort(v.begin(),v.end());
reverse(v.end()-k,v.end());
if(!proveri()) cout<<-1<<endl;
else{
    for(i=0;i<n;i++) cout<<v[i]<<" ";
}
return 0;
}
# 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 256 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 3 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 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 1396 KB Output is correct
2 Correct 21 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 2760 KB Output is correct
2 Correct 41 ms 2548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 136 ms 7164 KB Output is correct
2 Correct 95 ms 5480 KB Output is correct