답안 #475515

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
475515 2021-09-22T18:13:45 Z Sarah_Mokhtar 사육제 (CEOI14_carnival) C++14
0 / 100
1 ms 328 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define read freopen("acpc.in","r",stdin);
#define LESSGO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll N=150,M=505,OO=1e16,mod=1e9+9;
int n,ans[N];
vector<int>cols;
int ask(int l,int r,int i){
    cout<<r-1+1<<endl;
    for(int i=l;i<=r;++i) cout<<cols[i]<<' ';
    if(~i) cout<<i<<' ';
    cout<<endl;
    int output; cin>>output;
    return output;
}
int rangeAsk(int l,int r){
    cout<<r-1+1<<endl;
    for(int i=l;i<=r;++i) cout<<i<<' ';
    cout<<endl;
    int output; cin>>output;
    return output;
}
int solve(int l,int r,int i){
    if(l==r){
        return l;
    }
    int mid=(l+r)>>1;
    int a=ask(l,mid,i);
    int b=ask(l,mid,-1);
    if(a==b) return solve(l,mid,i);
    else return solve(mid+1,r,i);
}
int main(){
    cin>>n;
    ans[1]=1;
    for(int i=2;i<=n;++i){
        int g=rangeAsk(1,i);
        if(g!=ans[i-1]){
            cols.push_back(i);
            ans[i]=g;
            continue;
        }
        ans[i]=ans[solve(1,i-1,i)];
    }
    for(int i=0;i<n;++i){
        cout<<ans[i+1]<<' ';
    }
    cout<<endl;

}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 328 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -