Submission #99329

#TimeUsernameProblemLanguageResultExecution timeMemory
99329long10024070Carnival (CEOI14_carnival)C++11
Compilation error
0 ms0 KiB
#define Link "https://oj.uz/problem/view/CEOI14_carnival?fbclid=IwAR1nvQ7Ibq-nGYUPmX75LbvZGOpdx2hLsTE0ATdCwf9cC2bkAG_Ss27JVJc" #include <iostream> #include <cstdio> #define TASK "Carnival" using namespace std; const int maxn = 2e2 + 10; int n,c[maxn]; void Enter() { cin >> n; } void Init() { } int ASK(int l, int r, int d) { if (d == 0) cout << r - l + 1; else cout << r - l + 2; for (int i=l;i<=r;++i) cout << ' ' << i; if (d != 0) cout << ' ' << d; cout << endl; int res = 0; cin >> res; return res; } void ANSWER() { for (int i=0;i<=n;++i) cout << c[i] << ' '; cout << endl; } void Solve() { for (int i=1;i<=n;++i) { if (ASK(1,i,0) != cnt) c[i] = ++cnt; else { int l = 1; int r = i - 1; while (l <= r) { int m = (l + r) / 2; if (ASK(1,m,0) < ASK(1,m,i)) l = m + 1; else r = m - 1; } c[i] = c[l]; } } ANSWER(); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #ifdef LHL freopen(".INP","r",stdin); freopen(".OUT","w",stdout); #else // freopen(TASK".INP","r",stdin); // freopen(TASK".OUT","w",stdout); #endif // LHL Enter(); Init(); Solve(); }

Compilation message (stderr)

carnival.cpp: In function 'void Solve()':
carnival.cpp:49:27: error: 'cnt' was not declared in this scope
         if (ASK(1,i,0) != cnt)
                           ^~~
carnival.cpp:49:27: note: suggested alternative: 'int'
         if (ASK(1,i,0) != cnt)
                           ^~~
                           int