# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1118764 | ElayV13 | Table Tennis (info1cup20_tabletennis) | C++17 | 407 ms | 52732 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld double
const int INF = 1e18;
const int mod = 1e9 + 7;
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n , k;
cin >> n >> k;
vector < int > a(n + k);
unordered_map < int , int > m;
for(int i = 0;i < n + k;i++)
{
cin >> a[i];
m[a[i]]++;
}
vector < pair < int , int > > p;
map < int , int > cnt;
for(int i = 0;i < min(n + k , 5000LL) - 1;i++)
{
for(int j = i + 1;j < min(n + k , 1000LL);j++)
{
cnt[a[i] + a[j]]++;
p.push_back({cnt[a[i] + a[j]],a[i] + a[j]});
}
}
sort(p.begin() , p.end());
int ls = p[p.size() - 1].second;
vector < int > ans;
for(int i = 0;i < n + k;i++)
{
if(ans.size() == n) break;
if(m[ls - a[i]] > 0)
{
ans.push_back(a[i]);
ans.push_back(ls - a[i]);
}
}
sort(ans.begin() , ans.end());
for(int i : ans) cout << i << ' ';
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |