Submission #921396

# Submission time Handle Problem Language Result Execution time Memory
921396 2024-02-03T18:55:05 Z maxFedorchuk Table Tennis (info1cup20_tabletennis) C++17
9 / 100
89 ms 4700 KB
#include "bits/stdc++.h"
using namespace std;

const long long MX=2e5+10;

long long vis[MX];
long long a[MX];

long long n,k;

bool ok=0;

void solve(long long sum,long long nm)
{
    long long l=1,r=n+k,kpr=0,kg=0;

    while(l<r)
    {
        if((a[l]+a[r])<sum)
        {
            l++;
            kpr++;
        }
        else
        {
            if((a[l]+a[r])==sum)
            {
                vis[l]=vis[r]=nm;
                l++;
                r--;
                kg+=2;
            }
            else
            {
                if((a[l]+a[r])>sum)
                {
                    r--;
                    kpr++;
                }
            }
        }

        if(kpr>k)
        {
            return;
        }

        if(kg==n)
        {
            for(long long i=1;i<=n;i++)
            {
                if(vis[i]==nm)
                {
                    cout<<a[i]<<" ";
                }
            }

            ok=1;
            return;
        }
    }
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);

    cin>>n>>k;

    for(long long i=1;i<=n+k;i++)
    {
        cin>>a[i];
    }

    for(long long i=1,uk=1;(i<=(k+1) && (!ok));i++,uk++)
    {
        for(long long j=max(n,i+1);(j<=n+k && (!ok));j++,uk++)
        {
            solve(a[i]+a[j],uk);
        }
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2652 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 4444 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Incorrect 2 ms 2396 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Incorrect 1 ms 2396 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 28 ms 4700 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 89 ms 4480 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -