Submission #99260

# Submission time Handle Problem Language Result Execution time Memory
99260 2019-03-02T03:19:22 Z duy_tran Carnival (CEOI14_carnival) C++14
0 / 100
15 ms 384 KB
#include<bits/stdc++.h>
using namespace std;

const int maxn=(int)200;
int n,chk[maxn],c;
vector<int> a;

int main()
{
    cin>>n;

    for(int i=1;i<=n;++i)
    {
        int cnt=0;
        a.clear();
        for(int j=1;j<=n;++j)
            if(!chk[j])a.push_back(j),++cnt;

        int l=0;int r=a.size()-1;
        int mid;

        cout<<cnt<<" ";
        //fflush(stdout);
        for(int j:a)
        {
            cout<<j<<" ";
            //fflush(stdout);
        }
        cout<<endl;

        cin>>c;

        if(c==1)
        {
            for(int j:a)chk[j]=c;
            break;
        }

        else
        {
            int l=0;int r=a.size()-1;
            int mid;

            while(l<=r)
            {
                mid=(l+r)/2;

                int nc;
                cout<<mid<<" ";
                //fflush(stdout);
                for(int j=0;j<mid;++j)
                {
                    cout<<a[j]<<" ";
                    //fflush(stdout);
                }
                cout<<endl;

                cin>>nc;

                if(nc<c-1)l=mid+1;
                else r=mid-1;
            }

            chk[a[l]]=c;
        }
    }

    int en=0;
    cout<<en<<" ";

    for(int i=1;i<=n;++i)
    {
        cout<<chk[i]<<" ";
        //fflush(stdout);
    }
    cout<<endl;
    return(0);
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:19:13: warning: unused variable 'l' [-Wunused-variable]
         int l=0;int r=a.size()-1;
             ^
carnival.cpp:19:21: warning: unused variable 'r' [-Wunused-variable]
         int l=0;int r=a.size()-1;
                     ^
carnival.cpp:20:13: warning: unused variable 'mid' [-Wunused-variable]
         int mid;
             ^~~
# Verdict Execution time Memory Grader output
1 Execution timed out 8 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 14 ms 256 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Execution timed out 15 ms 384 KB Time limit exceeded (wall clock)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 11 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 284 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -