Submission #1125815

#TimeUsernameProblemLanguageResultExecution timeMemory
1125815efishelCarnival (CEOI14_carnival)C++20
0 / 100
2 ms432 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
using ii = pair <ll, ll>;
using vii = vector <ii>;

ll fask (vll ve) {
    if (ve.size() == 0) return 0;
    cout << ve.size() << ' ';
    for (ll i : ve) cout << i+1 << ' ';
    cout << '\n' << flush;
    ll res;
    cin >> res;
    return res;
}

void answer (vll ve) {
    cout << "0 ";
    for (ll i : ve) cout << i+1 << ' ';
    cout << '\n' << flush;
}

int main () {
    cin.tie(nullptr) -> sync_with_stdio(false);
    ll n;
    cin >> n;
    vll key(n, -16);
    ll timer = 0;
    vll g = {};
    for (ll i = 0; i < n; i++) {
        ll l = 0, r = g.size()+1;
        while (l+1 < r) {
            ll mid = (l+r)/2;
            vll h(g.begin(), g.begin()+mid); // grab the first mid elements
            h.push_back(i);
            if (fask(h) == h.size()) { // i is unique among the first mid elemnts
                l = mid;
            } else {
                r = mid;
            }
        }
        if (l == g.size()) {
            g.push_back(i);
            key[i] = timer++;
        } else {
            key[i] = key[l];
        }
    }
    answer(key);
    return 0;
}
#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...