# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
168320 | 2019-12-12T12:01:13 Z | aydinenes | Karte (COCI18_karte) | C++11 | 343 ms | 9988 KB |
#include<bits/stdc++.h> #define mid(l,r) ((l+r)/2) using namespace std; const int N = 1e6 + 7; const int inf = 1e9 + 7; int n, k; vector<int> v; vector<int> ans; int main(){ cin >> n >> k; for(int i = 0; i < n; i++){ int t; cin >> t; v.push_back(t); } sort(v.begin(), v.end()); for(int i = n - k; i < n; i++){ if(v[i] <= ans.size()){ cout << "-1"; return 0; } ans.push_back(v[i]); } for(int i = 0; i < n - k; i++){ if(v[i] > k){ cout << "-1"; return 0; } ans.push_back(v[i]); } for(int i = ans.size() - 1; i >= 0; i--){ cout << ans[i] << " "; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 71 ms | 2356 KB | Output is correct |
2 | Correct | 60 ms | 1776 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 142 ms | 4200 KB | Output is correct |
2 | Correct | 121 ms | 3788 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 343 ms | 9988 KB | Output is correct |
2 | Correct | 293 ms | 8484 KB | Output is correct |