#include <bits/stdc++.h>
using namespace std;
#define break_it (1/0)
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;
};
for(int i = 0; i < n+k; i ++) cin >> a[i];
/* if(k == 1) {
for(int i = 0; i < n + k; i ++) {
vector <int> v;
for(int j = 0; j < n + k; j ++) {
if(i == j) continue;
v.push_back(a[j]);
}
if(check(v)){
for(auto i : v) cout << i << " ";
return false;
}
}
}else if(n+k<=18) {
for(int mask = 0; mask < (1 << (n+k)); mask ++) {
if(__builtin_popcount(mask) == n) {
vector <int> v;
for(int i = 0; i < n+k; i ++) {
if((mask & (1 << i))!=0) {
v.push_back(a[i]);
}
}
if(check(v)) {
for(int i = 0; i < v.size(); i ++) cout << v[i] << " ";
return false;
}
}
}
}else if(k == 1){*/
for(int i = 0; i <= 1; i ++) {
vector <int> v;
for(int j = 0; j < n + k; j ++) {
if(i == j) continue;
v.push_back(a[j]);
}
if(check(v)){
for(auto i : v) cout << i << " ";
return false;
}
}
for(int i = n - 1; i >= n -2; i --) {
vector <int> v;
for(int j = 0; j < n + k; j ++) {
if(i == j) continue;
v.push_back(a[j]);
}
if(check(v)){
for(auto i : v) cout << i << " ";
return false;
}
}
//}
return false;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Incorrect |
1 ms |
332 KB |
Unexpected end of file - int32 expected |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
604 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
3064 KB |
Extra information in the output file |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |