# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
710001 | vjudge1 | Carnival (CEOI14_carnival) | C++17 | 8 ms | 360 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>
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
#define LOCALIO "C:/Users/admin/Documents/Code/"
ll a[200];
vector <ll> col;
ll ask(vector <ll> a, ll y)
{
a.pb(y);
cout << a.size() << " ";
for (ll i:a) cout << i << " ";
cout << endl;
ll x; cin >> x;
return x;
}
int main()
{
ios_base::sync_with_stdio(NULL); cin.tie(nullptr); cout.tie(nullptr);
ll n; cin >> n;
col.pb(1); a[1]=1;
for (ll i=2; i<=n; i++)
{
if (ask(col, i)==col.size()+1)
{
col.pb(i);
a[i]=col.size();
continue;
}
ll lo=0, hi=col.size()-1;
while (hi>lo)
{
ll mid=(hi+lo)/2;
vector <ll> col1(col.begin()+lo, col.begin()+mid+1);
if (ask(col1, i)==mid-lo+2)
lo=mid+1;
else hi=mid;
}
a[i]=a[col[lo]];
}
cout << 0 << " ";
for (ll i=1; i<=n; i++)
cout << a[i] << " ";
cout << endl;
}
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... |