# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1028115 | elotelo966 | Table Tennis (info1cup20_tabletennis) | C++17 | 235 ms | 6020 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.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define OYY LLONG_MAX
#define mod 998244353
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define lim 1000005
#define fi first
#define se second
int n,k;
int N;
int dizi[lim];
vector<int> as;
inline bool cont(int l,int r){
int sum=dizi[l]+dizi[r];
vector<int> cev;
while(cev.size()+r-l+1>=n && l<r && cev.size()<n){
//cout<<l<<" "<<r<<endl;
while(cev.size()+r-l+1>=n && l<r && dizi[l]+dizi[r]>sum){
r--;
}
if(dizi[l]+dizi[r]==sum){
cev.push_back(dizi[l]);
cev.push_back(dizi[r]);
l++;
r--;
continue;
}
else if(dizi[l]+dizi[r]>sum){
break;
}
l++;
}
if(cev.size()==n){
as=cev;
return 0;
}
else return 1;
}
int32_t main(){
faster
cin>>n>>k;
N=n+k;
for(int i=1;i<=N;i++){
cin>>dizi[i];
}
bool stop=1;
for(int i=1;i<=N && stop;i++){
for(int j=i+1;j<=N && stop;j++){
//cout<<i<<" "<<j<<endl;
stop=cont(i,j);
//cout<<stop<<endl;
}
}
sort(as.begin(),as.end());
for(auto x:as){
cout<<x<<" ";
}
cout<<'\n';
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... |