# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
890289 | activedeltorre | Table Tennis (info1cup20_tabletennis) | C++14 | 127 ms | 11716 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 <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;
map<int,int>fre;
int v[155005],m,k,n;
vector<int>vec;
int calc(int i ,int j)
{
int useless,st,dr;
if(fre[v[i]+v[j]]==1)
{
return 0;
}
fre[v[i]+v[j]]=1;
useless=i-1+m-j;
st=i;
dr=j;
int grupe=0;
while(useless<=k)
{
if(dr<=st)
{
break;
}
if(v[st]+v[dr]==v[i]+v[j])
{
vec.push_back(v[st]);
vec.push_back(v[dr]);
st++;
dr--;
grupe+=2;
}
else if(v[st]+v[dr]<v[i]+v[j])
{
st++;
useless++;
}
else
{
dr--;
useless++;
}
if(grupe==n)
{
break;
}
}
if(grupe>=n)
{
sort(vec.begin(),vec.end());
for(i=0;i<n;i++)
{
cout<<vec[i]<<" ";
}
return 1;
}
vec.clear();
return 0;
}
int main()
{
int i,j,l,z;
cin>>n>>k;
m=n+k;
for(i=1;i<=m;i++)
{
cin>>v[i];
}
int imp=0;
for(i=1;i<=k+1;i++)
{
for(j=0;j<=k;j++)
{
z=m-j;
if(z>i && imp==0)
{
if(calc(i,z)==1)
{
imp=1;
}
}
}
}
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... |