Submission #845907

#TimeUsernameProblemLanguageResultExecution timeMemory
845907jamkel19Table Tennis (info1cup20_tabletennis)C++14
58 / 100
661 ms249148 KiB
#include <bits/stdc++.h> using namespace std; #define st first #define nd second typedef long long ll; int main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); int n,k; cin>>n>>k; int N=n+k; vector<int>a(N); vector<bool>b(2000000001,true); for(int i=0;i<N;i++) { cin>>a[i]; } for(int i=0;i<k+1;i++) { for(int j=0;j+i<k+1;j++) { int ile=0,co=a[i]+a[N-j-1]; if(b[co]) { b[co]=false; int start=i,meta=N-j-1; vector<int>c(n); for(int o=0;i+j+o<=k && start<meta;o++) { if(a[start]+a[meta]==co) { o--; c[ile]=a[start]; c[n-ile-1]=a[meta]; ile++; start++; meta--; } else { if(a[start]+a[meta]>co) { meta--; } else { start++; } } } if(ile>=n/2) { for(int w=0;w<n;w++) { cout<<c[w]<<" "; } cout<<endl; 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...