Submission #1282574

#TimeUsernameProblemLanguageResultExecution timeMemory
1282574Jawad_Akbar_JJXylophone (JOI18_xylophone)C++20
Compilation error
0 ms0 KiB
#include <iostream> #include "xylophone.h" using namespace std; int a[1<<16]; void solve(int n){ a[1] = n + n; int Min = 1, cur = 1; while (cur < n){ int d = query(cur, cur + 1), dd; if (Min == 1) a[cur + 1] = a[cur] + d; else a[cur + 1] = a[cur] - d; if (cur == n - 1) break; dd = query(cur, cur + 2); Min = Min ^ (dd == d); cur++; } int Mn = a[1] - 1, id1, idn; for (int i=1;i<=n;i++) Mn = min(Mn, a[i] - 1); for (int i=1;i<=n;i++){ a[i] -= Mn; if (a[i] == 1) id1 = i; if (a[i] == n) id2 = i; } for (int i=1;i<=n;i++) answer(i, a[i] + (n + 1 - 2 * a[i]) * (id1 > id2)); }

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:34:25: error: 'id2' was not declared in this scope; did you mean 'idn'?
   34 |                         id2 = i;
      |                         ^~~
      |                         idn
xylophone.cpp:38:62: error: 'id2' was not declared in this scope; did you mean 'idn'?
   38 |                 answer(i, a[i] + (n + 1 - 2 * a[i]) * (id1 > id2));
      |                                                              ^~~
      |                                                              idn