# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
908828 | vjudge1 | Carnival (CEOI14_carnival) | C++17 | 6 ms | 596 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>
using namespace std;
void invita (const vector<int> &v, int otro)
{
cout << v.size()+1 << " ";
for (int x: v) cout << x << " ";
cout << otro << endl;
}
int color[155];
void solve()
{
int n, x; cin >> n;
vector<int> p = {1};
color[1] = 1;
for (int i = 2; i <= n; i++)
{
invita(p, i);
cin >> x;
if(x==1){
color[i]=color[1];
continue;
}
if (x > p.size())
{
p.push_back(i);
color[i] = p.size();
continue;
}
int l = 0, r = p.size()-1;
int aux = 0;
while (l <= r)
{
int mit = (l+r) >> 1;
vector<int> temp;
for (int j = aux; j <= mit; j++)
temp.push_back(p[j]);
invita(temp, i);
cin >> x;
if(x==1){
color[i]=color[temp[0]];
break;
}
if (x == temp.size())
{
r = mit;
continue;
}
l = mit+1;
aux = l;
}
// color[i] = l;
}
cout << "0 ";
for (int i = 1; i <= n; i++)
cout << color[i] << " ";
cout << endl;
}
int main()
{
int t = 1; //cin >> t;
while (t--)
solve();
return 0;
}
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... |