Submission #918054

#TimeUsernameProblemLanguageResultExecution timeMemory
918054vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
4 ms344 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int r; int A[300] = {0}; int C[300] = {0}; int m = 0; int p(int l, int r, int x) { cout << r - l + 2 << ' ' << x << ' '; for(int i = l; i <= r; i ++) cout << C[i] << ' '; cout << endl; cin >> x; return x; } int32_t main () { int n; cin >> n; A[1] = ++m; C[1] = 1; for(int i = 2;i<=n;i++) { int N = p(1, m, i); if(N > m) { A[i] = ++m;C[m] = i; } else { int low = 1, hight = m; while(low < hight) { int mid = (low+hight) >> 1; if(p(low, mid, i) == mid + 1 - low) { hight = mid; } else { low = mid + 1; } } A[i] = A[C[low]]; } } A[0] = 0; for(int i = 0;i<=n;i++) { cout<<A[i]<<' '; } cout<<endl; fflush(stdout); return 0; }
#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...