#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];
unordered_map<int,bool>mp;
for(int i=0;i<sz;i++){
cin >>a[i];
mp[a[i]]=1;
}
sort(a,a+sz);
for(int i=0;i<=k;i++){
for(int j=0;j<=k-i;j++){
int ans=a[i]+a[sz-j-1];
int cur=0;
for(int i=0;i<sz;i++){
if(a[i]!=ans-a[i]){
if(!mp[ans-a[i]]){
if(cur<k&&cur>=0)cur++;
else cur=-1;
}
}
else{
if(cur<k&&cur>=0)cur++;
else cur=-1;
}
if(cur==-1)break;
}
if(cur==k){
for(int i=0;i<sz;i++){
if(mp[ans-a[i]]&&ans-a[i]!=a[i])cout<<a[i]<<' ';
}
return 0;
}
// cout<<v.back()<<' ';
}
}
// cout<<v.size()<<endl;
}
/*
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
1336 KB |
Output is correct |
2 |
Correct |
93 ms |
8368 KB |
Output is correct |
3 |
Correct |
63 ms |
8352 KB |
Output is correct |
4 |
Correct |
70 ms |
8424 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
75 ms |
8380 KB |
Output is correct |
2 |
Correct |
79 ms |
8416 KB |
Output is correct |
3 |
Correct |
70 ms |
8380 KB |
Output is correct |
4 |
Correct |
76 ms |
8404 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
852 KB |
Output is correct |
2 |
Correct |
75 ms |
12680 KB |
Output is correct |
3 |
Correct |
1 ms |
852 KB |
Output is correct |
4 |
Correct |
66 ms |
12276 KB |
Output is correct |
5 |
Correct |
1 ms |
852 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
73 ms |
8512 KB |
Output is correct |
3 |
Correct |
71 ms |
8388 KB |
Output is correct |
4 |
Correct |
72 ms |
8504 KB |
Output is correct |
5 |
Correct |
68 ms |
8320 KB |
Output is correct |
6 |
Correct |
55 ms |
8396 KB |
Output is correct |
7 |
Correct |
62 ms |
8416 KB |
Output is correct |
8 |
Correct |
66 ms |
8376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
6728 KB |
Output is correct |
2 |
Correct |
1892 ms |
80548 KB |
Output is correct |
3 |
Correct |
160 ms |
14776 KB |
Output is correct |
4 |
Execution timed out |
3087 ms |
329408 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |