Submission #845000

#TimeUsernameProblemLanguageResultExecution timeMemory
845000jamkel19Table Tennis (info1cup20_tabletennis)C++14
20 / 100
16 ms2904 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); 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=1,co=a[i]+a[N-j-1]; vector<int>b(n); b[0]=a[i]; b[n-1]=a[N-j-1]; for(int o=i+1;o<N-j-2;o++) { int start=o+1,meta=N-j-2,s=(start+meta/2); while(start<meta) { if(a[s]+a[o]==co) { break; } if(a[s]+a[o]>co) { meta=s; } if(a[s]+a[o]<co) { start=s+1; } s=(start+meta)/2; } if(a[s]+a[o]==co) { b[ile]=a[o]; b[n-1-ile]=a[s]; ile++; } if(ile==n/2) { break; } } if(ile==n/2) { for(int w=0;w<n;w++) { cout<<b[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...