# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
717410 | MrM7md | Table Tennis (info1cup20_tabletennis) | C++17 | 105 ms | 13620 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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);
vector<int>v;
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;
for(int i=i;i<=sz-j-1;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;
}
/*
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |