Submission #918473

#TimeUsernameProblemLanguageResultExecution timeMemory
918473vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
11 ms596 KiB
#include <bits/stdc++.h> #define ll long long #define pll pair<ll,ll> #define pb push_back #define eb emplace_back #define vl vector<ll> #define fi first #define se second #define in insert #define mpr make_pair #define lg(x) __lg(x) #define bpc(x) __builtin_popcount(x) #define all(v) v.begin(), v.end() //#define endl "\n" using namespace std; const int mod = 998244353; const long long inf = 1000000000000000000; const int sz = 3e5+5; /// mind the sz void solve(){ ll n, i, j, ret1, ret2, cx = 1; cin>>n; vl pre(n + 1), ans(n + 1); pre[1] = 1; ans[1] = 1; for(i=2;i<=n;i++){ cout << i << ' '; for(j=1;j<=i;j++){ cout << j << ' '; } cout << endl; cin>>pre[i]; if(pre[i] != pre[i-1]){ ans[i] = ++cx; continue; } ll lo = 1, hi = i-1, mid; while(lo < hi){ mid = (lo + hi) >> 1; cout << (mid - lo + 1) << ' '; for(j = lo; j<=mid; j++){ cout << j << ' '; } cout << endl; cin>>ret1; cout << (mid - lo + 2) << ' '; for(j = lo; j<=mid; j++){ cout << j << ' '; } cout << i << endl; cin>>ret2; if(ret1 != ret2){ lo = mid + 1; } else{ hi = mid; } } ans[i] = ans[lo]; } cout << 0 << ' '; for(i=1;i<=n;i++){ cout << ans[i] << ' '; } cout << endl; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); //precomp(); ll tst=1; //cin>>tst; while(tst--){ solve(); } } /* ok. */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...