제출 #667649

#제출 시각아이디문제언어결과실행 시간메모리
667649pedroslreyTable Tennis (info1cup20_tabletennis)C++14
72 / 100
3103 ms410396 KiB
#include <bits/stdc++.h> using namespace std; map<int, int> vals; bool test(vector<int> &xs, int n, int k, int x) { vector<int> marc(n + k+1); vector<int> pairs; for (int i = 0; i < n + k; ++i) if (!marc[i+1] && vals[x - xs[i]] != 0 && vals[x - xs[i]] != i + 1) { pairs.push_back(xs[i]); pairs.push_back(x - xs[i]); marc[vals[x - xs[i]]] = true; } sort(pairs.begin(), pairs.end()); if (pairs.size() >= n) { for (int i = 0; i < n; ++i) cout << pairs[i] << " "; cout << "\n"; return true; } return false; } int main() { int n, k; cin >> n >> k; vector<int> xs(n+k); for (int &x: xs) cin >> x; for (int i = 0; i < n + k; ++i) vals[xs[i]] = i + 1; for (int i = 0; i < k+1; ++i) for (int j = n-1; j < n + k; ++j) if (test(xs, n, k, xs[i] + xs[j])) return 0; }

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

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