# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
306523 | waterfall | Carnival (CEOI14_carnival) | C++11 | 8 ms | 256 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;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define pqb priority_queue<int>
#define pqs priority_queue<int,vi,greater<int> >
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define mk(arr,n,type) type *arr=new type[n];
#define w(x) int x; cin>>x; while(x--)
int N;
int colors[152];
int32_t main()
{
cin >> N;
colors[1] = 1;
vector<int> v;
v.push_back(1);
for(int i = 2; i <= N; i++)
{
//check if it is adding a new color
cout << v.size() + 1;
for(int j = 0; j < v.size(); j++)
{
cout << " " << v[j];
}
cout << " " << i << endl;
int c;
cin >> c;
if(c > v.size())
{
v.push_back(i);
colors[i] = v.size();
}
else
{
int lower = 0;
int upper = v.size() - 1;
while(lower != upper)
{
int mid = (lower + upper) / 2;
cout << mid - lower + 2;
for(int j = lower; j <= mid; j++)
{
cout << " " << v[j];
}
cout << " " << i << endl;
int c;
cin >> c;
if(c > (mid - lower + 1))
{
lower = mid + 1;
}
else
{
upper = mid;
}
}
colors[i] = lower + 1;
}
}
cout << 0;
for(int i = 1; i <= N; i++)
{
cout << " " << colors[i];
}
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... |