# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
674255 | vjudge1 | Carnival (CEOI14_carnival) | C++17 | 10 ms | 324 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 ll long long
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
const int mod=1e9+7, maxn=1e5+5;
int n, c[maxn], x, ki, ka, mid, res;
vector<int> v;
bool baru[maxn];
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
cin >> n;
v.pb(1);
c[1]=1;
for(int i=2; i<=n; i++) {
cout << v.size()+1 << ' ';
for(auto x:v) cout << x << ' ';
cout << i << endl;
cin >> x;
if(x>v.size()) baru[i]=true, v.pb(i), c[i]=v.size();
}
for(int i=2; i<=n; i++) {
if(baru[i]) continue;
ki=0, ka=v.size()-1;
while(ki<=ka) {
mid=(ki+ka)/2;
cout << mid+2 << ' ';
for(int i=0; i<=mid; i++) cout << v[i] << ' ';
cout << i << endl;
cin >> x;
if(x==mid+2) ki=mid+1;
else res=mid, ka=mid-1;
}
c[i]=c[v[res]];
}
cout << "0 ";
for(int i=1; i<=n; i++) cout << c[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... |