#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=i+j;
vector<int>v;
for(int w=i;w<=sz-j-1;w++){
if(a[w]!=ans-a[w]){
if(!mp[ans-a[w]]){
if(cur<k&&cur>=0)cur++;
else cur=-1;
}
else v.pb(a[w]);
}
else{
if(cur<k&&cur>=0)cur++;
else cur=-1;
}
if(cur==-1)break;
}
if(cur==k){
for(auto it:v){
cout<<it<<' ';
}
return 0;
}
// cout<<v.back()<<' ';
}
}
// cout<<v.size()<<endl;
}
/*
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
468 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
1744 KB |
Output is correct |
2 |
Correct |
58 ms |
11148 KB |
Output is correct |
3 |
Correct |
53 ms |
11148 KB |
Output is correct |
4 |
Correct |
63 ms |
11164 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
70 ms |
11096 KB |
Output is correct |
2 |
Correct |
53 ms |
11196 KB |
Output is correct |
3 |
Correct |
60 ms |
11180 KB |
Output is correct |
4 |
Correct |
63 ms |
11168 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
18 ms |
5576 KB |
Output is correct |
3 |
Correct |
1 ms |
548 KB |
Output is correct |
4 |
Correct |
23 ms |
6028 KB |
Output is correct |
5 |
Correct |
1 ms |
548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
2 ms |
480 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 |
54 ms |
11196 KB |
Output is correct |
3 |
Correct |
50 ms |
11132 KB |
Output is correct |
4 |
Correct |
57 ms |
11156 KB |
Output is correct |
5 |
Correct |
53 ms |
11168 KB |
Output is correct |
6 |
Correct |
68 ms |
12324 KB |
Output is correct |
7 |
Correct |
58 ms |
11260 KB |
Output is correct |
8 |
Correct |
49 ms |
11144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
3428 KB |
Output is correct |
2 |
Correct |
690 ms |
47872 KB |
Output is correct |
3 |
Correct |
85 ms |
16088 KB |
Output is correct |
4 |
Correct |
2386 ms |
224628 KB |
Output is correct |
5 |
Correct |
78 ms |
15504 KB |
Output is correct |
6 |
Correct |
944 ms |
12524 KB |
Output is correct |
7 |
Correct |
550 ms |
49544 KB |
Output is correct |
8 |
Correct |
88 ms |
15532 KB |
Output is correct |