Submission #692279

#TimeUsernameProblemLanguageResultExecution timeMemory
692279NeroZeinTable Tennis (info1cup20_tabletennis)C++17
87 / 100
3051 ms10176 KiB
/* * author: NeroZein * created: 01.02.2023 12:23:57 */ #include <bits/stdc++.h> using namespace std; #ifdef Nero #include "Deb.h" #else #define deb(...) #endif signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n, k; cin >> n >> k; vector<int> a(n + k); map<int, bool> mp; for (int i = 0; i < n + k; ++i) { cin >> a[i]; mp[a[i]] = 1; } sort(a.begin(), a.end()); for (int i = 0; i <= k; ++i) { for (int j = n + k - 1; j > i; --j) { int cnt = i + (n + k - j - 1); if (cnt > k) { break; } int tar = a[i] + a[j]; for (int x = i + 1; x < j; ++x) { if (!mp.count(tar - a[x])) { cnt++; } } if (cnt == k) { vector<int> ans; for (int x = i; x <= j; ++x) { if (mp.count(tar - a[x])) { ans.push_back(a[x]); } } for (int x : ans) { cout << x << ' '; } return 0; } } } 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...