# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
625883 | as111 | Carnival (CEOI14_carnival) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
using namespace std;
vector<int> pos;
int num[155], col[155], C;
int main()
{
int N; cin >> N;
for (int i=1;i<N;i++){
cout << N-i+1;
for (int j=i;j<=N;j++) cout << " " << j;
cout << endl;
cin >> (cost[i]);
}
num[N] = 1;
for (int i=1;i<=N;i++) if (num[i] != num[i+1]){
col[i] = ++C;
pos.push_back(i);
}
for (int i=1;i<=N;i++) if (!col[i]){
while (pos[0] < i) pos.erase(pos.begin());
int l = 0, r = pos.size(), a = pos.size();
while (l + 1 < r){
int m = (l + r) / 2;
int s = pos.size() - m + 1;
printf ("%d",s);
for (int i=m;i<pos.size();i++) printf (" %d",pos[i]);
printf (" %d\n",i); fflush(stdout);
int c; scanf ("%d",&c);
if (c == s) r = m;
else l = m;
}
col[i] = col[pos[l]];
}
printf ("0");
for (int i=1;i<=N;i++) printf (" %d",col[i]); puts(""); fflush(stdout);
return 0;
}