Submission #1125541

#TimeUsernameProblemLanguageResultExecution timeMemory
1125541codexistentKarte (COCI18_karte)C++20
120 / 120
148 ms6888 KiB
#include <bits/stdc++.h> using namespace std; #define MAXN 500005 #define ll long long #define FOR(i, a, b) for(ll i = a; i <= b; i++) ll n, k, c[MAXN]; int main(){ cin >> n >> k; FOR(i, 1, n) cin >> c[i]; sort(c + 1, c + 1 + n); for(ll i = k; i >= 1; i--){ if(c[n - (k - i)] < i){ cout << -1 << endl; return 0; } } if(n - k >= 1 && c[n - k] > k) { cout << -1 << endl; return 0; } FOR(i, k + 1, n) cout << c[n - (i - 1)] << " "; for(ll i = k; i >= 1; i--) cout << c[n - (k - i)] << " "; cout << endl; }
#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...