Submission #1232323

#TimeUsernameProblemLanguageResultExecution timeMemory
1232323atillama사육제 (CEOI14_carnival)C++20
0 / 100
4 ms432 KiB
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_multiset;

#define int long long
#define double long double
#define pb push_back
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define debug(x) cout << #x << " = " << x << '\n';
#define vdebug(a) cout << #a << " = "; for(auto x : a) cout << x << " "; cout << '\n';

const double eps = 1e-9;
const int mod = 1e9 + 7;
const int N = 2e5 + 5;
const int INF = 1e18;

signed main(){
    fastio;
    int n;
    cin >> n;
    vector<int> ans(n + 1, -1);
    ans[1] = 1;
    cout << 2 << " " << 1 << " " << 2 << endl;
    cout.flush();
    cin >> ans[2];
    int cnt = ans[2];
    for(int i = 3; i <= n; i++){
        cout << i << " ";
        for(int j = 1; j <= i; j++){
            cout << j << " ";
        }
        cout << endl;
        cout.flush();
        int x;
        cin >> x;
        if(x != cnt){
            cnt++;
            ans[i] = cnt;
        }else{
            int l = 1, r = i - 1;
            while(l < r){
                int mid = (l + r) / 2;
                int x;
                cout << mid - l + 1 + 1 << " ";
                set<int> st;
                for(int j = l; j <= mid; j++){
                    cout << j << " ";
                    st.insert(ans[j]);
                }
                cout << i << endl;
                cout.flush();
                cin >> x;
                int sz = st.size();
                if(x == sz){
                    r = mid;
                }else{
                    l = mid + 1;
                }
            }
            ans[i] = ans[l];
        }
    }
    for(int i = 1; i <= n; i++){
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}

/*
    freopen("x.in", "r", stdin);
    freopen("x.out", "w", stdout);
*/

//atilla
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...