제출 #683498

#제출 시각아이디문제언어결과실행 시간메모리
683498JooDdaeTable Tennis (info1cup20_tabletennis)C++17
0 / 100
30 ms3972 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) { 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 << v[i][0] << " "; for(int i=n/2-1;i>=0;i--) cout << v[i][1] << " "; for(int i=0;i<n/2;i++) assert(a[v[i][0]]+a[v[i][1]] == S); return 0; } } assert(0); }

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

tabletennis.cpp: In function 'int main()':
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...