Submission #1136010

#TimeUsernameProblemLanguageResultExecution timeMemory
1136010bpptidpTable Tennis (info1cup20_tabletennis)C++20
72 / 100
3095 ms15804 KiB
#include<bits/stdc++.h> using namespace std; using ll=long long; const int N=1.5e5+505; int a[N],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]; unordered_map<int,int>occ; vector<int>v; for(int fi=0;fi<=k;++fi){ for(int se=max(0,fi+n-2);se<n+k;++se){ int x=a[fi]+a[se]; for(int i=fi+1;i<se;++i) ++occ[a[i]]; v.push_back(a[fi]); v.push_back(a[se]); for(int i=fi+1;i<se;++i){ if(2*a[i]>x)break; if(2*a[i]==x){ if(occ[a[i]]<2)continue; v.push_back(a[i]); v.push_back(a[i]); occ[a[i]]-=2; }else if(occ[x-a[i]]){ v.push_back(a[i]); v.push_back(x-a[i]); --occ[x-a[i]]; --occ[a[i]]; } } if(v.size()>=n){ sort(v.begin(),v.end()); for(auto&x:v) cout<<x<<' '; return 0; } occ.clear(); v.clear(); } } assert(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...