#include <bits/stdc++.h>
using namespace std;
#define break_it assert(false)
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
vector <int> a(n+k);
function <int(vector <int>)> check=[&](vector <int> s) {
for(int i = 0; i < n; i ++) {
int j = i + 1;
if(j >= n or n - i - 1 < 0 or n - j - 1 < 0) break;
if(s[i] + s[n-i-1] == s[j]+s[n-j-1]) continue;
return 0;
}
return 1;
};
function <void(int, int)> solve=[&](int start, int end) {
vector <int> fors;
int sum = a[start] + a[end];
int none = -1;
for(int i = 0; i <= n+k-1; i ++) {
if(i + 1 > end or n - i - 1 < start) break;
if(a[i] + a[n-i-1] > sum) {
none = n - i - 1;
break;
}else if(a[i] + a[n-i-1] < sum) {
none = i;
break;
}
}
if(none == -1) {
none = (n+k)/2+1;
}
for(int i = 0; i <= n+k-1; i ++) {
if(none == i) continue;
fors.push_back(a[i]);
}
if(check(fors)) {
// cout << start << " " << end << endl;
for(auto i : fors) cout << i << " ";
exit(0);
}
};
for(int i = 0; i < n+k; i ++) cin >> a[i];
solve(0, n+k-1);
solve(0, n+k-2);
solve(1, n+k-1);
break_it;
return false;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
764 KB |
Output is correct |
2 |
Correct |
27 ms |
3136 KB |
Output is correct |
3 |
Runtime error |
17 ms |
2532 KB |
Execution killed with signal 6 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
3060 KB |
Extra information in the output file |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |