#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 << " ";
}
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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |