답안 #64392

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
64392 2018-08-04T09:33:31 Z FedericoS 사육제 (CEOI14_carnival) C++14
100 / 100
14 ms 588 KB
#include <iostream>
#include <vector>
#include <utility>
using namespace std;

int N;
vector<int> V;
int res;
int C[200];

bool check(int i, int l, int m){
    cout<<m-l+2<<" ";
    for(int j=l;j<m+1;j++)
        cout<<V[j]+1<<" ";
    cout<<i+1<<endl;
    cin>>res;
    return res==m-l+1;
}

int main(){

    cin>>N;

    for(int i=0;i<N;i++)
        C[i]=-1;

    for(int i=0;i<N;i++){
        cout<<V.size()+1<<" ";
        for(int x:V)
            cout<<x+1<<" ";
        cout<<i+1<<endl;
        cin>>res;
        if(res==V.size()+1){
            V.push_back(i);
            C[i]=V.size()-1;
        }
    }

    for(int i=0;i<N;i++)
        if(C[i]==-1){
            int l=0,r=V.size(),m;
            while(l<r){
                m=(l+r)/2;
                if(check(i,l,m))
                    r=m;
                else l=m+1;
            }
            C[i]=l;
        }


    cout<<0<<" ";
    for(int i=0;i<N;i++)
        cout<<C[i]+1<<" ";
    cout<<endl;

    return 0;

}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:33:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(res==V.size()+1){
            ~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 7 ms 440 KB Output is correct
3 Correct 8 ms 440 KB Output is correct
4 Correct 6 ms 440 KB Output is correct
5 Correct 8 ms 440 KB Output is correct
6 Correct 7 ms 572 KB Output is correct
7 Correct 13 ms 572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 572 KB Output is correct
2 Correct 14 ms 572 KB Output is correct
3 Correct 7 ms 572 KB Output is correct
4 Correct 5 ms 572 KB Output is correct
5 Correct 9 ms 572 KB Output is correct
6 Correct 8 ms 572 KB Output is correct
7 Correct 11 ms 572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 572 KB Output is correct
2 Correct 9 ms 572 KB Output is correct
3 Correct 12 ms 572 KB Output is correct
4 Correct 8 ms 572 KB Output is correct
5 Correct 10 ms 572 KB Output is correct
6 Correct 10 ms 572 KB Output is correct
7 Correct 9 ms 572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 572 KB Output is correct
2 Correct 8 ms 572 KB Output is correct
3 Correct 9 ms 572 KB Output is correct
4 Correct 6 ms 572 KB Output is correct
5 Correct 10 ms 572 KB Output is correct
6 Correct 13 ms 572 KB Output is correct
7 Correct 10 ms 572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 572 KB Output is correct
2 Correct 14 ms 572 KB Output is correct
3 Correct 8 ms 572 KB Output is correct
4 Correct 9 ms 572 KB Output is correct
5 Correct 9 ms 588 KB Output is correct
6 Correct 5 ms 588 KB Output is correct
7 Correct 7 ms 588 KB Output is correct