제출 #1001110

#제출 시각아이디문제언어결과실행 시간메모리
1001110kachim2Table Tennis (info1cup20_tabletennis)C++17
87 / 100
3061 ms6776 KiB
#include <algorithm> #include <bits/stdc++.h> #include <cstdint> #include <vector> using namespace std; vector<pair<int, int>> res; vector<pair<int, int>> &check_balanced(vector<int> in, int val) { res.resize(0); int j = in.size()-1; for (int i = 0; i < j; i++){ while(in[i]+in[j]>val) j--; if(in[i]+in[j]==val) res.push_back({in[i], in[j]}); } return res; } int main() { int N, K; cin >> N >> K; vector<int> input(N+K); for(int i = 0; i < N+K; i++){ cin >> input[i]; } sort(input.begin(), input.end()); for(int i = 0; i <= K; i++){ for(int j = 0; j + i <= K; j++){ const int sp = N+K-j-1; auto a = check_balanced(input, input[i]+input[sp]); if(a.size()>=N/2){ vector<int> out; for(auto i : a){ out.push_back(i.first); out.push_back(i.second); } sort(out.begin(), out.end()); for(int i = 0; i < N; i++){ cout << out[i] <<' '; } return 0; } } } }

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

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:31:19: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   31 |        if(a.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...