# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
740344 | Unforgettablepl | Carnival (CEOI14_carnival) | C++17 | 9 ms | 316 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.
/*
ID: samikgo1
TASK:
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef pair<ll,ll> pll;
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define f first
#define s second
//#define x first
//#define y second
const int INF = INT32_MAX;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
// freopen("haybales.in","r",stdin);
// freopen("haybales.out","w",stdout);
int n;
cin >> n;
vector<int> unique = {1};
vector<int> ans(n+1);
ans[1] = 1;
for (int i = 2; i <= n; i++) {
cout << unique.size()+1;
for(int&j:unique)cout << ' ' << j;
cout << ' ' << i << endl;
int a;
cin >> a;
if(a==unique.size()+1){
unique.emplace_back(i);
ans[i] = unique.size();
} else {
// Now binary search
int l = 0;
int r = unique.size()-1;
while(l<r){
int mid = (l+r)>>1;
cout << mid-l+2;
for (int j = l; j <= mid; j++) {
cout << ' ' << unique[j];
}
cout << ' ' << i << endl;
cin >> a;
if(a==mid-l+2){l=mid+1;}
else{r = mid;}
}
ans[i] = ans[unique[l]];
}
}
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... |