#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define F first
#define S second
using namespace std;
const int N=2e5+5;
int n,k;
bool f[N];
double a[N];
map < int , int > mp;
void check(double x) {
int r=n+k,ans=0;
for (int i=1; i<=n+k; i++) f[i]=0;
for (int l=1; l<r && a[l]<=x; l++) {
while (x-a[l]<a[r]-x)
--r;
if (l<r && x-a[l]==a[r]-x)
f[l]=f[r]=1,ans+=2,--r;
if (ans==n) break;
}
if (ans==n) {
for (int i=1; i<=n+k; i++)
if (f[i]) cout<<a[i]<<" ";
exit(0);
}
}
main() {
ios::sync_with_stdio(false);
cin.tie(NULL),cout.tie(NULL);
cin>>n>>k;
for (int i=1; i<=n+k; i++)
cin>>a[i];
int R=min(2*k,n+k);
int L=max(1,n-k+1);
for (int i=1; i<=R; i++)
for (int j=L; j<=n+k; j++)
mp[a[i]+a[j]]++;
for (map < int , int > :: iterator it=mp.begin(); it!=mp.end(); ++it) {
if ((it->second)>=k)
check((it->first)/2.0);
}
}
Compilation message
tabletennis.cpp:37:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
37 | main() {
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Expected integer, but "6.50547e+08" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
768 KB |
Expected integer, but "1.01123e+06" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
152 ms |
3448 KB |
Expected integer, but "5.25776e+07" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
768 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Incorrect |
1 ms |
384 KB |
Expected integer, but "6.25669e+07" found |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
45 ms |
4600 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |