Submission #143202

#TimeUsernameProblemLanguageResultExecution timeMemory
143202ShelbyKarte (COCI18_karte)C++11
120 / 120
136 ms7164 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...