#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a,b) for (int a = 0; a < (b); ++a)
#define pb push_back
#define all(t) t.begin(), t.end()
const int max_N = 160005;
ll n = 0, k = 0;
ll sum = 0;
ll A[max_N];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> k;
rep(i,n+k) cin >> A[i];
if (n+k <= 18)
{
for (int i = 1; i < (1 << (n+k)); ++i)
{
vector<int> V;
rep(j,n+k)
{
auto b = (1 << j) & i;
if (b) V.pb(A[j]);
}
if (V.size() != n) continue;
int S = V[0] + V.back();
bool czy_OK = true;
for (int j = 1; j < n/2; ++j) if (V[j] + V[n-j-1] != S) czy_OK = false;
if (czy_OK == true)
{
rep(j,n+k)
{
auto b = (1 << j) & i;
if (b) cout << A[j] << ' ';
}
cout << '\n';
return 0;
}
}
return 0;
}
rep(i,n) sum += A[i];
rep(i,n+k)
{
ll il = sum - A[i];
if (il % (ll)(n/2) == 0)
{
ll szukana = il / (n/2);
bool czy_OK = true;
vector<ll> V;
rep(j,n+k) if (i != j) V.pb(A[j]);
rep(j,n/2) if (V[j] + V[j+n/2] != szukana)
{
czy_OK = false;
break;
}
if (czy_OK == true)
{
rep(j,n+k) if (i != j) cout << A[j] << ' ';
return 0;
}
}
}
return 0;
}
Compilation message
tabletennis.cpp: In function 'int main()':
tabletennis.cpp:32:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
32 | if (V.size() != n) continue;
| ~~~~~~~~~^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
600 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
4888 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |