#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mxN = 2e5 + 7;
int arr[mxN];
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, k;
cin >> n >> k;
//bitset<2000000001> in;
map<int,bool> in;
for (int i = 0; i < n + k; ++i) {
cin >> arr[i];
in[arr[i]] = true;
}
map<int,int> freq;
for (int i = 0; i < max(k, (int) sqrt(n)); ++i) {
for (int j = n + k - 1; j >= n + k - max(k, (int) sqrt(n)) && j > i; --j) {
int sum = arr[i] + arr[j];
freq[sum]++;
}
}
int mx = 0, sum = 0;
for (auto p : freq) {
if (p.second > mx) {
mx = p.second;
sum = p.first;
}
}
vector<int> nums;
for (int l = 0; l < n + k; ++l) {
if (sum - arr[l] >= 0 && in[sum - arr[l]]) {
nums.push_back(arr[l]);
}
}
for (int l = 0; l < n; ++l) {
cout << nums[l] << ' ';
}
cout << "\n";
}
// 1 2 1 2 3
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
596 KB |
Output not sorted |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
2212 KB |
Output is correct |
2 |
Correct |
120 ms |
22628 KB |
Output is correct |
3 |
Correct |
122 ms |
22612 KB |
Output is correct |
4 |
Correct |
145 ms |
22656 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
77 ms |
13756 KB |
Output is correct |
2 |
Correct |
105 ms |
19136 KB |
Output is correct |
3 |
Runtime error |
90 ms |
38928 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
724 KB |
Output not sorted |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output not sorted |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output not sorted |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output not sorted |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
6080 KB |
Output not sorted |
2 |
Halted |
0 ms |
0 KB |
- |