# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
105440 |
2019-04-12T10:48:36 Z |
igzi |
Karte (COCI18_karte) |
C++17 |
|
143 ms |
5452 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 |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
412 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
1524 KB |
Output is correct |
2 |
Correct |
20 ms |
1664 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
73 ms |
2388 KB |
Output is correct |
2 |
Correct |
43 ms |
2548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
143 ms |
4924 KB |
Output is correct |
2 |
Correct |
127 ms |
5452 KB |
Output is correct |