# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
366026 | soba | Table Tennis (info1cup20_tabletennis) | C++14 | 3066 ms | 186144 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;
typedef long long ll;
int main()
{
ll n , k;
cin >> n >> k ;
ll teams=n/2;
vector<ll>v;
ll x , y ;
n+=k;
map<ll,int>mp;
for(int i = 0 ; i < n ; i++)
{
cin >> x;
mp[x]++;
v.push_back(x);
}
sort(v.begin(), v.end());
vector<ll>poten;
for(int i = 0 ; i< k+1 ; i++)
{
for( int j = n-1; j >= n-(k+1) ; j-- )
{
poten.push_back(v[i]+v[j]);
}
}
int sz=poten.size();
vector<ll>ansa , ansb;
for( int i = 0 ; i < sz ; i++)
{
int tmam=1;
ansa.clear();
ansb.clear();
ll tmp=teams;
for(int j = 0 ; j < n ; j++ )
{
if(poten[i]-v[j]==v[j])continue;
if(mp[poten[i]-v[j]])
{
tmp--;
ansa.push_back(poten[i]-v[j]);
ansb.push_back(v[j]);
tmam=0;
}
if(tmp==0)
break;
}
if(tmp)
{
tmam=false;
}
if(tmam)
{
break;
}
}
for(int i = 0 ; i < teams ; i++)
{
cout << ansa[i] << " " << ansb[i] << " ";
}
return 0;
}
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... |