Submission #987446

#TimeUsernameProblemLanguageResultExecution timeMemory
987446user736482Table Tennis (info1cup20_tabletennis)C++17
0 / 100
60 ms4584 KiB
#include<bits/stdc++.h> using namespace std; int n,k,a,b,c; vector<int>v,v2; int main(){ cin>>n>>k; for(int i=0;i<n+k;i++){ cin>>a; v.push_back(a); } for(int i=0;i<k;i++){ for(int j=0;j+i<n;j++){ v2.clear(); int pocz=i,kon=(int)v.size()-1-j,skipped=i+j,suma=v[i]+v[(int)v.size()-1-j]; v2.push_back(v[i]); v2.push_back(v[(int)v.size()-1-j]); pocz++; kon--; //cout<<pocz<<kon<<skipped<<" "; while((int)v2.size()!=n && skipped<k+1){ if(v[pocz]+v[kon]==suma){ v2.push_back(v[pocz]); v2.push_back(v[kon]); pocz++; kon--; } else if(v[pocz]+v[kon]<suma){ pocz++; skipped++; } else{ kon--; skipped++; } } if((int)v2.size()==n){ sort(v2.begin(),v2.end()); for(int l=0;l<(int)v2.size();l++){ cout<<v2[l]<<" "; } cout<<"\n"; 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...