제출 #551944

#제출 시각아이디문제언어결과실행 시간메모리
551944colossal_pepeTable Tennis (info1cup20_tabletennis)C++17
72 / 100
3075 ms10920 KiB
#include <iostream> #include <set> using namespace std; int n, m, a[200005]; set<int> s; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m; for (int i = 0; i < n + m; i++) { cin >> a[i]; s.insert(a[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 = a[i] + a[j]; int cnt = 0; for (int k = 0; k < n + m; k++) { if (s.find(total - a[k]) != s.end()) cnt++; } if (cnt >= n) { cnt = n; for (int k = 0; k < n + k; k++) { if (not cnt) break; if (s.find(total - a[k]) != s.end()) { cout << a[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...