Submission #524829

#TimeUsernameProblemLanguageResultExecution timeMemory
524829boykutTable Tennis (info1cup20_tabletennis)C++14
9 / 100
3133 ms796564 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, k; cin >> n >> k; vector<int> a(n); map<int, int> cnt; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { cnt[a[i] + a[j]]++; } } int mx = -1, sum = -1; for (auto it : cnt) { if (it.second > mx) mx = it.second, sum = it.first; } assert(sum != -1); set<int> st(a.begin(), a.end()); vector<int> ans; for (int i = 0; i < n; i++) { if (st.count(sum - a[i])) { ans.push_back(a[i]); ans.push_back(sum - a[i]); st.erase(sum - a[i]); st.erase(a[i]); } } sort(ans.begin(), ans.end()); for (int v : ans) cout << v << ' '; 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...