# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
57143 |
2018-07-14T07:00:14 Z |
polyfish |
Karte (COCI18_karte) |
C++14 |
|
1000 ms |
4056 KB |
//I love armpit fetish
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define FILE_NAME "data"
const int MAX_N = 500002;
int n, k, a[MAX_N];
void enter() {
cin >> n >> k;
for (int i=1; i<=n; ++i)
cin >> a[i];
}
bool check() {
int false_claim = 0;
PR(a, n);
for (int i=n; i>=1; --i) {
if (a[i]>false_claim) {
++false_claim;
}
}
return false_claim == k;
}
void solve() {
sort(a+1, a+n+1);
reverse(a+n-k+1, a+n+1);
reverse(a+1, a+n-k+1);
if (check()) {
for (int i=1; i<=n; ++i)
cout << a[i] << ' ';
}
else {
cout << -1;
}
}
int main() {
//#define OFFLINE_JUDGE doraemon
#ifdef OFFLINE_JUDGE
freopen(FILE_NAME".inp", "r", stdin);
freopen(FILE_NAME".out", "w", stdout);
#endif
ios::sync_with_stdio(0); cin.tie(0);
enter();
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
Expected integer, but "a" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
484 KB |
Expected integer, but "a" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
484 KB |
Expected integer, but "a" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
484 KB |
Expected integer, but "a" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
484 KB |
Expected integer, but "a" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
604 KB |
Expected integer, but "a" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
604 KB |
Expected integer, but "a" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
399 ms |
1820 KB |
Expected integer, but "a" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
675 ms |
3428 KB |
Expected integer, but "a" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1068 ms |
4056 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |