Submission #533422

#TimeUsernameProblemLanguageResultExecution timeMemory
533422devariaotaCarnival (CEOI14_carnival)C++17
100 / 100
9 ms212 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; #define pairll pair<ll,ll> #define lpairll pair<ll,pairll> #define pb push_back #define mp make_pair #define fr first #define sc second #define repp(i,a,b) for(ll i = (a); i <= (b); i++) #define repm(i, a, b) for (ll i = (a); i >= (b); i--) #define repz(i, a, b) for (ll i = (a); i < (b); i++) const long long MOD = 1e9+7, N = 1e5 + 5, M = 1e3+5, INF = 1e9; ll tc = 1, n, m,k,cr[N],ans[N], col = 1; string s, ye = "YES", no = "NO", nu; void fastt(){ ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); } ll ask(ll l, ll r, ll num){ cout << r-l+2 << " "; repp(i,l,r) cout << cr[i] << " "; cout << num << endl; cin >> m; return m; } void op(){ cout << "0 "; repp(i,1,n) cout << ans[i] << " "; cout << endl; } void input(){ cin >> n; } void solve(){ ans[1] = cr[1] = 1; repp(i,2,n){ ll res = ask(1,col,i); if(res > col){ col++; cr[col] = i; ans[i] = col; continue; } ll l = 1, r = col; while (l < r){ ll mid = (l+r)/2, res; res = ask(l,mid,i); if(res == mid-l+1) r = mid; else l = mid+1; } ans[i] = l; } op(); } int main(){ // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); fastt(); while(tc--){ input(); solve(); } } /* 3 1 2 3 1 2 3 5 2 8 6 3 1 1 2 3 6 8 (n-1)/2 */
#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...