# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
777463 | MetalPower | Carnival (CEOI14_carnival) | C++14 | 6 ms | 208 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;
const int MX = 155;
int N, ans[MX];
vector<int> df;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> N;
ans[1] = 1;
df.push_back(1);
int tim = 2;
for(int i = 2; i <= N; i++){
int l = 0, r = (int) df.size() - 1, memo = -1;
for(; l <= r; ){
int mid = l + r >> 1;
vector<int> nw;
for(int j = l; j <= mid; j++) nw.push_back(df[j]);
nw.push_back(i);
cout << nw.size();
for(int x : nw) cout << " " << x;
cout << endl;
int num; cin >> num;
if(num == (int) nw.size() - 1) memo = mid, r = mid - 1;
else l = mid + 1;
}
if(memo == -1) ans[i] = tim++, df.push_back(i);
else ans[i] = df[memo];
}
cout << 0;
for(int i = 1; i <= N; i++) cout << " " << ans[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... |