Submission #1183632

#TimeUsernameProblemLanguageResultExecution timeMemory
1183632attkyCarnival (CEOI14_carnival)C++20
100 / 100
13 ms408 KiB
#include <bits/stdc++.h>

using namespace std;

int nbCostume(int left, int right) {
    cout << (right - left + 1) << " ";
    for(int loop = left; loop <= right; ++loop) {
        cout << loop+1 << " ";
    }
    cout << endl;
    int answer;
    cin >> answer;
    return answer;
}

int main() {
    int n;
    cin >> n;
    int costume[n] = {0}, iCost = 1;
    for(int loop = 0; loop < n-1; ++loop) {
        if(costume[loop] == 0) {
            costume[loop] = iCost;
            iCost++;
        }
        int nextSame = n-1;
        for(int looping = 256; looping > 0; looping /= 2) {
            if(nextSame - looping > loop) {
                if(nbCostume(loop, nextSame - looping) == nbCostume(loop + 1, nextSame - looping)) {
                    nextSame -= looping;
                }
            }
        }
        if(nbCostume(loop, nextSame) == nbCostume(loop + 1, nextSame)) {
            costume[nextSame] = costume[loop];
        }
    }
    if(costume[n-1] == 0) {
        costume[n-1] = iCost;
    }
    cout << "0 ";
    for(int loop = 0; loop < n; ++loop) {
        cout << costume[loop] << " ";
    }
    cout << endl;
    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...