제출 #1013065

#제출 시각아이디문제언어결과실행 시간메모리
1013065LuvidiTable Tennis (info1cup20_tabletennis)C++17
100 / 100
50 ms4728 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll, ll> #define pii pair<int, int> #define fs first #define sc second #define pb push_back void solve() { int n,k,m; cin>>n>>k; m=n+k; int a[m]; for(int i=0;i<m;i++)cin>>a[i]; for(int i=0;i<k+1;i++){ int x=k-i; for(int j=m-1;j>=i&&k-i-(m-1-j)>=0;j--){ int x=k-i-(m-1-j),s=a[i]+a[j],c=0; int l=i,r=j; vector<pii> v; while(l<r){ if(a[l]+a[r]==s){ v.pb({a[l],a[r]}); l++; r--; c++; }else if(a[l]+a[r]<s){ l++; x--; }else{ r--; x--; } if(x<0)break; if(c==n/2)break; } if(c==n/2){ for(pii p:v)cout<<p.fs<<' '; reverse(v.begin(),v.end()); for(pii p:v)cout<<p.sc<<' '; return; } } } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); }

컴파일 시 표준 에러 (stderr) 메시지

tabletennis.cpp: In function 'void solve()':
tabletennis.cpp:18:13: warning: unused variable 'x' [-Wunused-variable]
   18 |         int x=k-i;
      |             ^
#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...