#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
mt19937 rnd(time(0));
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n,k;cin>>n>>k;
vector<int> v(n+k);
for(int i=0;i<n+k;i++){
cin>>v[i];
}
int flag=0;
auto check=[&](int p)->void {
int j=n+k-1;
int cnt=0;
vector<int> ans;
for(int i=0;i<n+k;i++){
while(i<j&&v[i]+v[j]>p){
j--;
}
if(i>=j){
break;
}
if(i<j&&v[i]+v[j]==p){
ans.push_back(v[i]);
ans.push_back(v[j]);
cnt+=2;
j--;
}
}
//cout<<ans.size()<<endl;
if(cnt>=n){
sort(ans.begin(),ans.begin()+n);
for(int i=0;i<n;i++){
cout<<ans[i]<<' ';
}
cout<<endl;
flag=1;
}
};
while(!flag){
int i=rnd()%(k+1);
int j=n-1+rnd()%(k+1);
check(v[i]+v[j]);
}
assert(false);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
1032 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
27 ms |
3412 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
734 ms |
440 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |