Submission #105440

#TimeUsernameProblemLanguageResultExecution timeMemory
105440igziKarte (COCI18_karte)C++17
120 / 120
143 ms5452 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...