답안 #918473

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
918473 2024-01-29T21:23:49 Z vjudge1 사육제 (CEOI14_carnival) C++17
100 / 100
11 ms 596 KB
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define pb push_back
#define eb emplace_back
#define vl vector<ll>
#define fi first
#define se second
#define in insert
#define mpr make_pair
#define lg(x) __lg(x)
#define bpc(x) __builtin_popcount(x)
#define all(v) v.begin(), v.end()
//#define endl "\n"
using namespace std;
const int mod = 998244353;
const long long inf = 1000000000000000000;
const int sz = 3e5+5; /// mind the sz
void solve(){
    ll n, i, j, ret1, ret2, cx = 1;
    cin>>n;
    vl pre(n + 1), ans(n + 1);
    pre[1] = 1;
    ans[1] = 1;
    for(i=2;i<=n;i++){
        cout << i << ' ';
        for(j=1;j<=i;j++){
            cout << j << ' ';
        }
        cout << endl;
        cin>>pre[i];
        if(pre[i] != pre[i-1]){
            ans[i] = ++cx;
            continue;
        }
        ll lo = 1, hi = i-1, mid;
        while(lo < hi){
            mid = (lo + hi) >> 1;
            cout << (mid - lo + 1) << ' ';
            for(j = lo; j<=mid; j++){
                cout << j << ' ';
            }
            cout << endl;
            cin>>ret1;
            cout << (mid - lo + 2) << ' ';
            for(j = lo; j<=mid; j++){
                cout << j << ' ';
            }
            cout << i << endl;
            cin>>ret2;
            if(ret1 != ret2){
                lo = mid + 1;
            }
            else{
                hi = mid;
            }
        }
        ans[i] = ans[lo];
    }
    cout << 0 << ' ';
    for(i=1;i<=n;i++){
        cout << ans[i] << ' ';
    }
    cout << endl;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //precomp();
    ll tst=1;
    //cin>>tst;
    while(tst--){
        solve();
    }
}
/*
ok.
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 596 KB Output is correct
2 Correct 8 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 7 ms 344 KB Output is correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 7 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 340 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Correct 7 ms 344 KB Output is correct
7 Correct 7 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 7 ms 344 KB Output is correct
6 Correct 9 ms 344 KB Output is correct
7 Correct 6 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 344 KB Output is correct
2 Correct 8 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 7 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 344 KB Output is correct
2 Correct 8 ms 344 KB Output is correct
3 Correct 5 ms 596 KB Output is correct
4 Correct 4 ms 340 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 2 ms 344 KB Output is correct