Submission #540675

#TimeUsernameProblemLanguageResultExecution timeMemory
540675RyoPhamCarnival (CEOI14_carnival)C++17
100 / 100
14 ms336 KiB
#include <bits/stdc++.h> using namespace std; #define sz(x) (int)x.size() #define fi first #define se second #define mp make_pair typedef long long lli; typedef pair<int, int> pii; const int maxn = 155; int n, m; int c[maxn]; int mem[maxn]; void ask(int l, int r, int x) { cout << r - l + 2; for(int i = l; i <= r; ++i) cout << ' ' << i; cout << ' ' << x << endl; } void answer() { cout << 0; for(int i = 1; i <= n; ++i) cout << ' ' << c[i]; cout << endl; } void read_input() { cin >> n; } void solve() { m = 1; c[1] = 1; mem[1] = 1; for(int i = 2; i <= n; ++i) { ask(1, i - 1, i); int k; cin >> k; mem[i] = k; if(k == m + 1) { ++m; c[i] = m; continue; } int low = 1, high = i - 1; while(low <= high) { int mid = (low + high) / 2; ask(1, mid, i); cin >> k; if(k == mem[mid] + 1) low = mid + 1; else high = mid - 1; } c[i] = c[low]; } answer(); } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); read_input(); solve(); }
#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...