Submission #532220

#TimeUsernameProblemLanguageResultExecution timeMemory
532220makanhuliaCarnival (CEOI14_carnival)C++17
100 / 100
20 ms504 KiB
#include <bits/stdc++.h> #define REP(v, i, j) for (int v = i; v < j; v++) #define FORI(v) for (auto i : v) #define FORJ(v) for (auto j : v) #define OUT(v, a) FORI(v) cout << i << a; #define OUTS(v, a, b) cout << v.size() << a; OUT(v, b) #define in(a, n) REP(i, 0, n) cin >> a[i]; #define SORT(v) sort(begin(v), end(v)) #define REV(v) reverse(begin(v), end(v)) #define pb push_back #define fi first #define se second #define detachIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); using namespace std; typedef pair<int, int> pii; typedef pair<pii, int> piii; typedef pair<pii, pii> piiii; //#define DEBUG int c[300][300]; int ans[300]; int t[10] = {0, 1, 2, 1, 3, 2}; int query(int x, int y) { #ifndef DEBUG if (c[x][y] != 0) return c[x][y]; cout << (y - x + 1); REP(i, x, y + 1) cout << ' ' << i; cout << endl; int resp; cin >> resp; c[x][y] = resp; return resp; #else set<int> st; REP(i, x, y + 1) st.insert(t[i]); return st.size(); #endif } int main() { int n; cin >> n; ans[1] = 1; int alloc = 2; REP(i, 2, n + 1) { int x = -1; int L = 1, R = i - 1; while (L <= R) { int mid = (L + R) / 2; if (query(mid, i - 1) == query(mid, i)) x = mid, L = mid + 1; else R = mid - 1; } if (x > 0) ans[i] = ans[x]; else ans[i] = alloc++; } cout << 0; REP(i, 1, n + 1) cout << ' ' << ans[i]; }
#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...