# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1066333 | goduadzesaba | Table Tennis (info1cup20_tabletennis) | C++17 | 3069 ms | 4472 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
const int N=2e5+5,mod=1e9+7;
int n,k,a[N],x,y,sm,ans;
vector <int> v;
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
srand(time(0));
cin>>n>>k;
for (int i=1; i<=n+k; i++)
cin>>a[i];
sort(a+1,a+n+k+1);
while (1){
x=rand()%(k+1)+1;
y=rand()%(k+1)+n;
sm=a[x]+a[y]; v.clear();
x=1; y=n+k; ans=0;
while (x<y){
if (a[x]+a[y]<sm){
x++;
}
else if (a[x]+a[y]>sm){
y--;
}
else{
if (v.size()<n){
v.push_back(a[x]);
v.push_back(a[y]);
}
ans++; x++; y--;
}
}
if (ans>=n/2){
sort(v.begin(),v.end());
for (int i:v) cout<<i<<" ";
return 0;
}
}
}
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... |