답안 #99264

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
99264 2019-03-02T03:29:23 Z duy_tran 사육제 (CEOI14_carnival) C++14
0 / 100
15 ms 256 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;
        }
    }


}

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;
                         ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 256 KB Output is correct
2 Incorrect 15 ms 256 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 15 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -