Submission #99259

# Submission time Handle Problem Language Result Execution time Memory
99259 2019-03-02T03:17:55 Z duy_tran Carnival (CEOI14_carnival) C++14
0 / 100
13 ms 412 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;
}

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 7 ms 256 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 10 ms 412 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 13 ms 256 KB Time limit exceeded (wall clock)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 12 ms 256 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -