| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1368127 | po_rag526 | Table Tennis (info1cup20_tabletennis) | C++20 | 52 ms | 11084 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
ll a, b; cin >> a >> b;
vector <ll> v(a + b + 1);
for (int i = 1; i <= a + b; i++) cin >> v[i];
ll total = a + b;
if (total <= 4 * b){
set <ll> s;
for (int i = 1; i <= a + b - 1; i++){
for (int j = i + 1; j <= a + b; j++){
s.insert(v[i] + v[j]);
}
}
vector <ll> cand(s.begin(), s.end()), ans;
for (auto x : cand){
vector <ll> res;
ll l = 1, r = a + b;
while (l < r){
if (v[l] + v[r] == x){
res.push_back(v[l]);
res.push_back(v[r]);
l++; r--;
}
else if (v[l] + v[r] < x) l++;
else r--;
}
if (res.size() == a) ans = res;
}
sort(ans.begin(), ans.end());
for (auto x : ans) cout << x << " ";
}
else{
map <ll, ll> counter;
for (int i = 1; i <= b; i++){
for (int j = a; j <= a + b; j++){
if (i != j) counter[v[i] + v[j]]++;
}
}
vector <ll> cand, ans;
for (auto [sum, count] : counter){
if (count >= b) cand.push_back(sum);
}
for (auto x : cand){
vector <ll> res;
ll l = 1, r = a + b;
while (l < r){
if (v[l] + v[r] == x){
res.push_back(v[l]);
res.push_back(v[r]);
l++; r--;
}
else if (v[l] + v[r] < x) l++;
else r--;
}
if (res.size() == a) ans = res;
}
sort(ans.begin(), ans.end());
for (auto x : ans) cout << x << " ";
}
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
