Submission #99265

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

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

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

    cin>>n;

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

        cout<<cnt<<" ";
        for(int j=1;j<a.size();++j)cout<<a[j]<<" ";
        cout<<endl;
        fflush(stdout);

        int c;
        cin>>c;

        if(c==1)
        {
            for(int j=1;j<a.size();++j)chk[a[j]]=1;

            cout<<0<<" ";
            for(int j=1;j<=n;++j)cout<<chk[j]<<" ";
            cout<<endl;
            fflush(stdout);


            exit(0);
        }

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

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

                int nc;
                cout<<mid<<" ";
                for(int j=1;j<=mid;++j)cout<<a[j]<<" ";
                cout<<endl;
                fflush(stdout);

                cin>>nc;

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

            chk[a[l]]=c;

            for(int j=a[l]+1;j<=n;++j)
            {
                if(!chk[j])
                {
                    cout<<2<<" ";
                    cout<<a[l]<<" "<<j<<endl;
                    fflush(stdout);

                    int cc;
                    cin>>cc;

                    if(cc==1)chk[j]=chk[a[l]];
                }
            }
        }
    }


}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:30:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=1;j<a.size();++j)cout<<a[j]<<" ";
                     ~^~~~~~~~~
carnival.cpp:39:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int j=1;j<a.size();++j)chk[a[j]]=1;
                         ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 12 ms 256 KB Output is correct
2 Correct 15 ms 256 KB Output is correct
3 Correct 18 ms 256 KB Output is correct
4 Correct 13 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 17 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 20 ms 384 KB Output is correct
3 Correct 14 ms 256 KB Output is correct
4 Correct 23 ms 256 KB Output is correct
5 Correct 11 ms 384 KB Output is correct
6 Correct 14 ms 256 KB Output is correct
7 Correct 7 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 32 ms 384 KB Output is correct
4 Correct 23 ms 256 KB Output is correct
5 Correct 21 ms 256 KB Output is correct
6 Correct 22 ms 384 KB Output is correct
7 Correct 19 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 304 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 26 ms 256 KB Output is correct
4 Correct 21 ms 384 KB Output is correct
5 Correct 29 ms 256 KB Output is correct
6 Correct 17 ms 384 KB Output is correct
7 Correct 27 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 284 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 26 ms 256 KB Output is correct
4 Correct 29 ms 384 KB Output is correct
5 Correct 34 ms 256 KB Output is correct
6 Correct 33 ms 256 KB Output is correct
7 Correct 23 ms 384 KB Output is correct