Submission #1136050

#TimeUsernameProblemLanguageResultExecution timeMemory
1136050bpptidpTable Tennis (info1cup20_tabletennis)C++20
87 / 100
3091 ms3260 KiB
#include<bits/stdc++.h> using namespace std; using ll=long long; const int N=1.5e5,K=405; int a[N+K],n,k; signed main(){ ios::sync_with_stdio(0); cin.tie(0); cin>>n>>k; for(int i=0;i<n+k;++i) cin>>a[i]; for(int i=0;i<=k;++i){ for(int j=i+n-1;j<n+k;++j){ int x=a[i]+a[j],l=i+1,r=j-1,br=1; while(l<r){ if(a[l]+a[r]==x)++l,--r,++br; else if(a[l]+a[r]<x)++l; else --r; } if(br>=n/2){ vector<int>v={a[i],a[j]}; l=i+1,r=j-1; while(l<r){ if(a[l]+a[r]==x){ v.push_back(a[l]); v.push_back(a[r]); ++l,--r; }else if(a[l]+a[r]<x)++l; else --r; } sort(v.begin(),v.end()); for(auto&xx:v)cout<<xx<<' '; return 0; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...