제출 #524636

#제출 시각아이디문제언어결과실행 시간메모리
524636aminTable Tennis (info1cup20_tabletennis)C++14
9 / 100
3070 ms1484 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long n,k; cin>>n>>k; long long a[n+k]; for(long i=0;i<n+k;i++) { cin>>a[i]; } long long sum; long long j=0; long long ans=0; long long p=0; long long l,r; for(long i=0;i<=k;i++) { for(long y=i+n-1;y<n+k;y++) { j=0; ans=0; p=0; sum=a[i]+a[y]; r=y-1; l=i+1; ans=2; while(l<r) { if(p>k) { break; } if(a[l]+a[r]>sum) { r--; p++; continue; } if(a[l]+a[r]<sum) { p++; l++; continue; } if(a[l]+a[r]==sum) { ans+=2; l++; r--; if(ans>=n) { j=1; break; } continue; } } if(j==1) { break; } } if(j==1) { break; } } l=0; r=n+k-1; ans=0; p=0; vector<long long>v; while(l<r) { if(a[l]+a[r]>sum) { r--; continue; } if(a[l]+a[r]<sum) { p++; continue; } if(a[l]+a[r]==sum) { ans+=2; v.push_back(a[l]); v.push_back(a[r]); l++; r--; if(ans>=n) { j=1; break; } continue; } } sort(v.begin(),v.end()); for(long i=0;i<n;i++) { cout<<v[i]<<' '; } }

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

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:106:13: warning: 'sum' may be used uninitialized in this function [-Wmaybe-uninitialized]
  106 |             if(a[l]+a[r]==sum)
      |             ^~
#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...