Submission #551946

#TimeUsernameProblemLanguageResultExecution timeMemory
551946colossal_pepeTable Tennis (info1cup20_tabletennis)C++17
87 / 100
3065 ms3840 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 = 0; i <= m + 1; i++) { for (int j = n + m - 1; j >= max(i + 1, n - 1); j--) { int total = v[i] + v[j]; int cnt = 0; for (int k = 0; k < n + m; k++) { if (binary_search(v.begin(), v.end(), total - v[k])) cnt++; } if (cnt >= n) { cnt = n; for (int k = 0; k < n + k; k++) { if (not cnt) break; if (binary_search(v.begin(), v.end(), total - v[k])) { cout << v[k] << ' '; cnt--; } } cout << '\n'; done = 1; break; } } if (done) break; } return 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...