#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define read freopen("in.txt","r",stdin);freopen("out.txt","w",stdout)
const ll N=1e6+10,M=505,OO=1e16,mod=1e9+7;
int n,k;
ll a[N];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>k;
for(int i=0;i<n+k;++i){
cin>>a[i];
}
vector<ll>ans;
for(int i=0;i<=k;++i){
for(int j=n-1;j>=n-1;--j){
unordered_map<ll,int>cnt;
for(int p=0;p<n+k;++p){
cnt[a[p]]++;
}
ll sum=a[i]+a[j];
int pairs=0;
vector<ll>cur;
for(int l=0;l<n+k;++l){
if(cnt[sum-a[l]]){
cur.push_back(a[l]);
cur.push_back(sum-a[l]);
++pairs;
cnt[sum-a[l]]--;
cnt[a[l]]--;
}
if(pairs==n/2){
ans=cur;
break;
}
}
if(!ans.empty()) break;
}
if(!ans.empty()) break;
}
sort(ans.begin(),ans.end());
for(ll i:ans) cout<<i<<' ';
cout<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
460 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
1612 KB |
Output not subsequence of input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
260 ms |
16368 KB |
Output is correct |
2 |
Correct |
80 ms |
10804 KB |
Output is correct |
3 |
Incorrect |
299 ms |
14976 KB |
Unexpected end of file - int32 expected |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
5 ms |
332 KB |
Unexpected end of file - int32 expected |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
8 ms |
460 KB |
Unexpected end of file - int32 expected |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
2256 ms |
15640 KB |
Unexpected end of file - int32 expected |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Execution timed out |
3072 ms |
15620 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |