제출 #844997

#제출 시각아이디문제언어결과실행 시간메모리
844997jamkel19Table Tennis (info1cup20_tabletennis)C++14
20 / 100
18 ms6740 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); ll n,k; cin>>n>>k; ll N=n+k; vector<ll>a(N); for(ll i=0;i<N;i++) { cin>>a[i]; } for(ll i=0;i<k+1;i++) { for(ll j=0;j+i<k+1;j++) { ll ile=1,co=a[i]+a[N-j-1]; vector<ll>b(n); b[0]=a[i]; b[n-1]=a[N-j-1]; for(ll o=i+1;o<N-j-2;o++) { ll 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...