제출 #683507

#제출 시각아이디문제언어결과실행 시간메모리
683507JooDdaeTable Tennis (info1cup20_tabletennis)C++17
100 / 100
69 ms4624 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int n, k, a[200200]; int main(){ cin.tie(0)->sync_with_stdio(0); cin >> n >> k; for(int i=1;i<=n+k;i++) cin >> a[i]; for(int A=0;A<=k;A++) for(int B=0;A+B<=k;B++) { int L = A+1, R = n+k-B; int S = a[L] + a[R]; int l = L+1, r = R-1; vector<array<int, 2>> v = {{L, R}}; while(l < r && v.size()+(r-l+1)/2 >= n/2) { if(a[l] + a[r] == S) { v.push_back({l, r}); l++, r--; continue; } if(S-a[l] > a[r]) l++; else r--; } if(v.size() >= n/2) { for(int i=0;i<n/2;i++) cout << a[v[i][0]] << " "; for(int i=n/2-1;i>=0;i--) cout << a[v[i][1]] << " "; return 0; } } assert(0); }

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

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:18:43: warning: comparison of integer expressions of different signedness: 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |         while(l < r && v.size()+(r-l+1)/2 >= n/2) {
      |                        ~~~~~~~~~~~~~~~~~~~^~~~~~
tabletennis.cpp:29:21: warning: comparison of integer expressions of different signedness: 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |         if(v.size() >= n/2) {
      |            ~~~~~~~~~^~~~~~
#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...