#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define all(a) a.begin(),a.end()
const int N=1e5;
const int off=(1<<20);
const int MOD = 1e9+7;
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n,k;
cin >> n >> k;
int sz=n+k;
int a[sz];
map<int,int>mp;
for(int i=0;i<sz;i++){
cin >>a[i];
mp[a[i]]++;
}
sort(a,a+sz);
int f=a[sz/2]+a[sz/2-1],s=a[sz/2]+a[sz/2+1],t=a[0]+a[sz-1];
int x=0,y=0,z=0;
// cout<<f<<' '<<s << ' '<<t<<endl;
for(int i=0;i<sz;i++){
if(a[i]!=f-a[i]){
if(!mp[f-a[i]]){
if(x)x=-1;
else x=a[i];
}
}
else{
x=a[i];
}
if(a[i]!=s-a[i]){
if(!mp[s-a[i]]){
if(y)z=-1;
else y=a[i];
}
}
else{
y=a[i];
}
if(a[i]!=t-a[i]){
if(!mp[t-a[i]]){
if(z)z=-1;
else z=a[i];
}
}
else{
z=a[i];
}
}
int ans=max({z,x,y});
for(int i=0;i<sz;i++){
if(a[i]!=ans)cout<<a[i]<<' ';
}
}
/*
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
724 KB |
Output is correct |
2 |
Correct |
2 ms |
724 KB |
Output is correct |
3 |
Correct |
3 ms |
724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
1892 KB |
Output is correct |
2 |
Correct |
131 ms |
31136 KB |
Output is correct |
3 |
Correct |
128 ms |
31052 KB |
Output is correct |
4 |
Correct |
130 ms |
31016 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
132 ms |
31064 KB |
Extra information in the output file |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output does not have symmetry property |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output does not have symmetry property |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output does not have symmetry property |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output does not have symmetry property |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output does not have symmetry property |
2 |
Halted |
0 ms |
0 KB |
- |