Submission #555824

#TimeUsernameProblemLanguageResultExecution timeMemory
555824colossal_pepeTable Tennis (info1cup20_tabletennis)C++17
100 / 100
2785 ms3916 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; int n, m; vector<int> v; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m; v.resize(n + m); for (int i = 0; i < n + m; i++) { cin >> v[i]; } bool done = 0; for (int i = (n / 2) - 1; i <= (n / 2) - 1 + m; i++) { int total = v[i] + v[i + 1]; int cnt = 0; for (int j = 0; j < n + m; j++) { if (binary_search(v.begin(), v.end(), total - v[j])) cnt++; } if (cnt < n) continue; cnt = n; for (int j = 0; j < n + m; j++) { if (cnt == 0) break; if (binary_search(v.begin(), v.end(), total - v[j])) { cout << v[j] << ' '; cnt--; } } break; } return 0; }

Compilation message (stderr)

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:17:10: warning: unused variable 'done' [-Wunused-variable]
   17 |     bool done = 0;
      |          ^~~~
#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...