# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
874795 | eu_caue | Carnival (CEOI14_carnival) | C++14 | 1 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;
typedef long long ll;
const int maxn = 155;
int pai[maxn], peso[maxn], colors[maxn];
vector<int> heads;
int query(int tl, int tr, int i){
if(tl == tr) return heads[tl];
int mid = (tl+tr)>>1;
cout << i << ' ';
for(int j = tl; j <= mid; j++) cout << heads[j] << ' ';
cout << endl;
int ans; cin >> ans;
if(ans == mid-tl+1) return query(tl, mid, i);
return query(mid+1, tr, i);
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
int n; cin >> n;
int color = 1, nheads = 0;
for(int i = 1; i <= n; i++) pai[i] = i;
for(int i = 1; i <= n; i++){
cout << i << ' ';
for(int k : heads) cout << k << ' ';
cout << endl;
int ans; cin >> ans;
if(ans == heads.size()+1){
colors[i] = color;
color++;
heads.push_back(i);
continue;
}
pai[i] = query(0, heads.size(), i);
}
for(int i = 0; i <= n; i++) cout << colors[pai[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... |