# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
689814 | TomitaMatei | Table Tennis (info1cup20_tabletennis) | C++14 | 205 ms | 468 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 <iostream>
#include <algorithm>
using namespace std;
int n,k,i,j,i1,j2,t,dr,st,s,nr,v[16000],r[16000],ok,x;
int main()
{
cin>>n>>k;
x=n+k;
for (i=1; i<=x; i++)
cin>>v[i];
sort (v+1,v+x+1);
for (st=1; st<=k+1; st++)
for (dr=n+k; dr>=n+st-1; dr--)
{
i=st;
j=dr;
s=v[i]+v[j];
nr=1;
r[1]=v[i];
r[n-nr+1]=v[j];
i++;
j--;
ok=0;
if (nr*2==n)
{
for (i=1; i<=n; i++)
cout<<r[i]<<" ";
return 0;
}
while (i<j)
{
for (j2=j; j2>i; j2--)
if (s==v[i]+v[j2])
{
nr++;
r[n-nr+1]=v[j2];
r[nr]=v[i];
ok=1;
break;
}
if (nr*2==n)
{
for (i=1; i<=n; i++)
cout<<r[i]<<" ";
return 0;
}
if (ok==0)
i++;
else
{
ok=0;
i++;
j=j2-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... |