# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
717356 | 2023-04-01T21:36:05 Z | vjudge1 | Table Tennis (info1cup20_tabletennis) | C++17 | 1 ms | 724 KB |
#include <bits/stdc++.h> #define endl '\n' #define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define int ll typedef long long ll; using namespace std; const int N = 15e4 + 10, mod = 1e9 + 7; int n, k, a[N]; bool vis[N]; map<int, vector<pair<int, int> > > mp; void solve1() { int ch1 = a[0] + a[n+k-1], ch2 = a[0] + a[n+k-2], ch3 = a[1] + a[n+k-1]; int cnt1 = 0, cnt2 = 0, cnt3 = 0; for(int i = 0; i < n + k; i++) { if(vis[ch1 - a[i]]) cnt1++; if(vis[ch2 - a[i]]) cnt2++; if(vis[ch3 - a[i]]) cnt3++; } int num = 0; if(cnt1 >= cnt2 && cnt1 >= cnt3) num = ch1; else if(cnt2 >= cnt1 && cnt2 >= cnt3) num = ch2; else num = ch3; int dont = a[n+k-1]; for(int i = 0; i < n + k; i++) { if(vis[num - a[i]]) cout << a[i] << ' '; } } void solve2() { } signed main() { FAST; cin >> n >> k; int num = 0; for(int i = 0; i < n + k; i++) { cin >> a[i]; vis[a[i]] = 1; } if(k == 1) { solve1(); return 0; } if(k == 2) { solve2(); return 0; } for(int i = 0; i < n + k - 1; i++) { for(int j = i + 1; j < n + k; j++) { mp[a[i] + a[j]].push_back({a[i], a[j]}); if(mp[a[i] + a[j]].size() >= n / 2) num = a[i] + a[j]; } } vector<int> v; int i = 0; while(v.size() < n && i < mp[num].size()) { v.push_back(mp[num][i].first); v.push_back(mp[num][i].second); i++; } sort(v.begin(), v.end()); for(auto it : v) { cout << it << ' '; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 724 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 724 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |