제출 #736793

#제출 시각아이디문제언어결과실행 시간메모리
736793stevancvTable Tennis (info1cup20_tabletennis)C++14
100 / 100
621 ms6044 KiB
#include <bits/stdc++.h> #define ll long long #define ld long double #define sp ' ' #define en '\n' #define smin(a, b) a = min(a, b) #define smax(a, b) a = max(a, b) using namespace std; const int N = 2e5 + 2; const ll linf = 1e18; int a[N], n, k; void Resi(int x) { vector<int> v; int p = n + k - 1; for (int i = 0; i < n + k - 1; i++) { while (i < p && a[i] + a[p] > x) p -= 1; if (i < p && a[i] + a[p] == x) { v.push_back(a[i]); v.push_back(a[p]); p -= 1; } } if (v.size() >= n) { vector<int> ans; for (int i = 0; i < n; i++) ans.push_back(v[i]); sort(ans.begin(), ans.end()); for (int i : ans) cout << i << sp; cout << en; exit(0); } } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> k; for (int i = 0; i < n + k; i++) cin >> a[i]; if (n <= k) for (int i = 0; i < n + k; i++) for (int j = i + 1; j < n + k; j++) Resi(a[i] + a[j]); mt19937 mt(time(nullptr)); while (1) { int x = mt() % (n + k); int mn = max(0, x - k); int mx = min(n - 1, x); mn = n - mn - 1; mx = n - mx - 1; int l = mx; int r = mn + k; for (int i = l; i <= r; i++) if (i != x) Resi(a[i] + a[x]); } return 0; }

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

tabletennis.cpp: In function 'void Resi(int)':
tabletennis.cpp:23:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |     if (v.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...