Submission #127394

#TimeUsernameProblemLanguageResultExecution timeMemory
127394impriKarte (COCI18_karte)C++14
120 / 120
336 ms7868 KiB
#include<bits/stdc++.h> using namespace std; int main(void){ int n,k; vector<int>a; cin >> n >> k; a.push_back(-1); for(int i=1;i<=n;i++){ int c; cin >> c; a.push_back(c); } sort(a.begin(),a.end()); for(int i=1;i<=n-k;i++){ if(a[i]>k){ cout << -1; return 0; } } for(int i=1;i<=k;i++){ if(a[i+n-k]<i){ cout << -1; return 0; } } for(int i=n-k;i>=1;i--){ cout << a[i] << " "; } for(int i=k;i>=1;i--){ cout << a[i+n-k] << " "; } }
#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...