# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
116651 | roseanne_pcy | Carnival (CEOI14_carnival) | C++14 | 10 ms | 432 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 <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;
#define X first
#define Y second
#define pb push_back
typedef pair<int, int> ii;
typedef long long ll;
const int maxn = 155;
vector<int> cand[maxn];
int col[maxn];
int ask(vector<int> vec)
{
printf("%d ", vec.size());
for(int x : vec) printf("%d ", x);
printf("\n");
fflush(stdout);
int res; scanf("%d", &res);
return res;
}
int solve(vector<int> poss, int x)
{
if(poss.size() == 1)
{
return col[poss[0]];
}
int lo = 0, hi = (int) poss.size()-1;
int mid = (lo+hi)/2;
vector<int> a1, a2;
for(int i = 0; i<= hi; i++)
{
if(i<= mid) a1.pb(poss[i]);
else a2.pb(poss[i]);
}
vector<int> send = a1;
send.pb(x);
int res = ask(send);
if(res == send.size()) return solve(a2, x);
return solve(a1, x);
}
int main()
{
int n; scanf("%d", &n);
col[1] = 1;
cand[1].pb(1);
int lim = 1;
for(int i = 2; i<= n; i++)
{
vector<int> send;
for(int j = 1; j<= lim; j++) send.pb(cand[j].back());
send.pb(i);
int res = ask(send);
if(res == lim+1)
{
col[i] = lim+1;
cand[lim+1].pb(i);
lim++;
continue;
}
send.pop_back();
col[i] = solve(send, i);
cand[col[i]].pb(i);
}
printf("0 ");
for(int i = 1; i<= n; i++) printf("%d ", col[i]);
printf("\n");
fflush(stdout);
}
Compilation message (stderr)
# | 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... |