Submission #1008882

#TimeUsernameProblemLanguageResultExecution timeMemory
1008882vjudge1Xylophone (JOI18_xylophone)C++17
Compilation error
0 ms0 KiB
#pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> using namespace std; const int MAX = 5002; int a[MAX]; void solve(int n) { for (int i = 2; i <= n; i++) { int x = query(1, i); int y = query(i - 1, i); if (abs(a[i - 1] + y) == x) a[i] = a[i - 1] + y; else a[i] = a[i - 1] - y; } int u = 0; a[0] = INT_MIN; for (int i = 1; i <= n; i++) { if (a[i] > a[u]) u = i; } int v = 0; a[0] = INT_MAX; for (int i = 1; i <= n; i++) { if (a[i] < a[v]) v = i; } if (u > v) { for (int i = 1; i <= n; i++) { answer(i, n - a[u] + a[i]); } } else { for (int i = 1; i <= n; i++) { answer(i, (n + 1) - (n - a[u] + a[i])); } } } /*int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); solve(); }*/

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:12:17: error: 'query' was not declared in this scope
   12 |         int x = query(1, i);
      |                 ^~~~~
xylophone.cpp:29:13: error: 'answer' was not declared in this scope
   29 |             answer(i, n - a[u] + a[i]);
      |             ^~~~~~
xylophone.cpp:33:13: error: 'answer' was not declared in this scope
   33 |             answer(i, (n + 1) - (n - a[u] + a[i]));
      |             ^~~~~~