#include <bits/stdc++.h>
// author: aykhn
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define OPT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(), v.end()
#define mpr make_pair
#define eb emplace_back
#define pb push_back
#define ts to_string
#define fi first
#define se second
#define ins insert
#define int ll
#define inf 0x3F3F3F3F
#define infll 0x3F3F3F3F3F3F3F3FLL
#define bpc __builtin_popcount
int n, k;
vector<int> v;
bool solve(int del)
{
int l = 0;
int r = n + k - 1;
int x = -1;
while (l < r)
{
if (l == del)
{
l++;
continue;
}
if (r == del)
{
r--;
continue;
}
if (v[l] + v[r] != x && x != -1)
{
return false;
}
x = v[l] + v[r];
l++;
r--;
}
return true;
}
void _()
{
cin >> n >> k;
v.assign(n + k, 0);
for (int i = 0; i < n + k; i++)
{
cin >> v[i];
}
sort(all(v));
for (int i = 0; i < n + k; i++)
{
if (solve(i))
{
for (int j = 0; j < n + k; j++)
{
if (j == i) continue;
cout << v[j] << " ";
}
cout << endl;
return;
}
}
}
int32_t main()
{
OPT;
_();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
616 KB |
Output is correct |
2 |
Correct |
31 ms |
2936 KB |
Output is correct |
3 |
Correct |
40 ms |
4300 KB |
Output is correct |
4 |
Correct |
46 ms |
4420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
1492 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |