제출 #442685

#제출 시각아이디문제언어결과실행 시간메모리
442685JovanBTable Tennis (info1cup20_tabletennis)C++17
100 / 100
169 ms4556 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const int MAXN = 200000; int a[MAXN+5]; int main(){ ios_base::sync_with_stdio(false), cin.tie(0); cout.precision(10); cout << fixed; int n, k; cin >> n >> k; vector <int> vec; for(int i=1; i<=n+k; i++){ cin >> a[i]; } for(int ls=1; ls<=k+1; ls++){ for(int rs=n+k; rs>=n; rs--){ int sum = a[ls] + a[rs]; vec.clear(); vec.push_back(a[ls]); vec.push_back(a[rs]); int j = rs; for(int i=ls+1; i<=rs; i++){ if(vec.size() + (j-i+1) < n) break; if(a[i] >= sum - a[i]) break; if(vec.size() == n) break; while(j > i && a[i] + a[j] > sum) j--; if(a[i] + a[j] == sum){ vec.push_back(a[i]); vec.push_back(a[j]); } } if(vec.size() == n){ sort(vec.begin(), vec.end()); for(auto c : vec) cout << c << " "; cout << "\n"; return 0; } } } return 0; }

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

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:30:41: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |                 if(vec.size() + (j-i+1) < n) break;
      |                    ~~~~~~~~~~~~~~~~~~~~~^~~
tabletennis.cpp:32:31: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |                 if(vec.size() == n) break;
      |                    ~~~~~~~~~~~^~~~
tabletennis.cpp:39:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |             if(vec.size() == n){
      |                ~~~~~~~~~~~^~~~
#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...