# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
919884 | HaciyevAlik | Carnival (CEOI14_carnival) | C++14 | 2 ms | 344 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;
using ll = long long;
int ans[155];
int main(){
//ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int n,x=1; cin >> n;
vector<int> v;
ans[1]=1;
v.push_back(1);
for(int i=2;i<=n;++i) {
int l=1,r=int(v.size()),best=0;
while(l<=r) {
int mid=(l+r)/2;
cout << mid + 1 << ' ' << i << ' ';
for(int j=0;j<mid;++j) {
cout << v[j] << ' ';
}
cout << '\n';
fflush(stdout);
int cur; cin >> cur;
if(cur==mid+1) {
best=mid;
l=mid+1;
} else {
r=mid-1;
}
}
if(best==v.size()) {
v.push_back(++x);
ans[i]=x;
} else {
ans[i]=v[best];
}
}
cout << "0 ";
for(int i=1;i<=n;++i) {
cout << ans[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... |