/*
* author: NeroZein
* created: 01.02.2023 12:23:57
*/
#include <bits/stdc++.h>
using namespace std;
#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif
const int N = (int) 2e9 + 9;
bitset<N> mp;
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, k;
cin >> n >> k;
vector<int> a(n + k);
for (int i = 0; i < n + k; ++i) {
cin >> a[i];
}
sort(a.begin(), a.end());
for (int i = 0; i <= k; ++i) {
for (int j = n + k - 1; j > i; --j) {
int cnt = i + (n + k - j - 1);
if (cnt > k) {
break;
}
int tar = a[i] + a[j];
for (int x = i + 1; x < j; ++x) {
if (mp[tar - a[x]] == 0) {
cnt++;
}
}
if (cnt == k) {
vector<int> ans;
for (int x = i; x <= j; ++x) {
if (mp[tar - a[x]]) {
ans.push_back(a[x]);
}
}
for (int x : ans) {
cout << x << ' ';
}
return 0;
}
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
468 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
1048 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
468 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
468 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
468 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
100 ms |
472 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |