답안 #919901

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
919901 2024-02-01T20:19:35 Z HaciyevAlik 사육제 (CEOI14_carnival) C++14
100 / 100
8 ms 596 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int ans[155];
int main(){
    //ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n,x=1; cin >> n;
    vector<int> v;
    ans[1]=1;
    v.push_back(1);
    for(int i=2;i<=n;++i) {
        int l=1,r=int(v.size()),best=0;
        while(l<=r) {
            int mid=(l+r)/2;
            cout << mid + 1 << ' ' << i << ' ';
            for(int j=0;j<mid;++j) {
                cout << v[j] << ' ';
            }
            cout << '\n';
            fflush(stdout);
            int cur; cin >> cur;
            if(cur==mid+1) {
                best=mid;
                l=mid+1;
            } else {
                r=mid-1;
            }
        }
        if(best==int(v.size())) {
            v.push_back(i);
            ans[i]=++x;
        } else {
            ans[i]=ans[v[best]];
        }
    }
    cout << "0 ";
    for(int i=1;i<=n;++i) {
        cout << ans[i] << ' ';
    }
    return 0;
}

// 1 2 3 2 2 4 1 5 6 5
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 6 ms 432 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 6 ms 344 KB Output is correct
4 Correct 8 ms 432 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 596 KB Output is correct
3 Correct 6 ms 344 KB Output is correct
4 Correct 7 ms 432 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 8 ms 436 KB Output is correct