Submission #365813

# Submission time Handle Problem Language Result Execution time Memory
365813 2021-02-12T12:21:21 Z soba Table Tennis (info1cup20_tabletennis) C++14
0 / 100
3000 ms 2780 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
bool solve(vector<ll>v)
{
    int l = 0 , r=v.size()-1;
    if(v[l]==-1)
            l++;
        if(v[r]==-1)
            r--;
    ll newmid, mid=(v[l]+v[r])/2;
    l++;
    r--;
    while(l<r)
    {
        if(v[l]==-1)
            l++;
        if(v[r]==-1)
            r--;
        newmid=(v[l]+v[r])>>1;
        l++;
        r--;
        if(mid!=newmid)
            return false;
    }
    return true;
}
int main()
{
    ll n , k ;
    cin >> n >> k;
    //cout << n  << " " << k << "\n";
    vector<ll>v;
    ll x , y;
    for(int i =  0 ; i < n+k ; i++)
    {
        cin>> x;
        v.push_back(x*2);
    }
    if(k==1)
    {
        for(int i  = 0 ; i < n+k ; i++)
        {
            x=v[i];
            v[i]=-1;
            if(solve(v))
            {
                cout << "yes\n";
                break;
            }
            else v[i]=x;
            cout << "no\n";
        }
        for(int i  = 0 ; i < n+k ; i++)
        {
            if(v[i]!=-1)
            {
                cout << v[i]/2 << " ";
            }
        }
        return 0;
    }
    if(k==2)
    {
        for(int i  = 0 ; i < n+k ; i++)
        {
            for(int j = i+1 ; j < n+k ; j++)
            {
                x=v[i];
                v[i]=-1;
                y=v[j];
                v[j]=-1;
                if(solve(v))
                {
                    break;
                }
                else
                {
                    v[i]=x;
                    v[j]=y;
                }
            }

        }
        for(int i  = 0 ; i < n+k ; i++)
        {
            if(v[i]!=-1)
            {
                cout << v[i]/2 << " ";
            }
        }
        return 0;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 364 KB Expected integer, but "yes" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 164 ms 840 KB Expected integer, but "no" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3060 ms 2780 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -