제출 #1320258

#제출 시각아이디문제언어결과실행 시간메모리
1320258ppmn_6Xylophone (JOI18_xylophone)C++20
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); // https://codeforces.com/blog/entry/79148 class Timer: chrono::high_resolution_clock { const time_point start_time; public: Timer(): start_time(now()) {} rep elapsed_time() const { return chrono::duration_cast<chrono::milliseconds>(now() - start_time).count(); } } timer; void solve(int n) { vector<int> d1(n + 1), d2(n + 1), pf(n + 1); vector<bool> dir(n + 1); dir[1] = 1; for (int i = 1; i < n; i++) { d1[i] = query(i, i + 1); } for (int i = 1; i < n - 1; i++) { d2[i] = query(i, i + 2); } for (int i = 2; i < n; i++) { dir[i] = dir[i - 1] ^ (d2[i - 1] != d1[i - 1] + d1[i]); } pf[1] = 0; int pos_ma = 1, pos_mi = 1; for (int i = 2; i <= n; i++) { pf[i] = pf[i - 1] + (dir[i - 1] ? 1 : -1) * d1[i - 1]; if (pf[i] < pf[pos_mi]) { pos_mi = i; } if (pf[i] > pf[pos_ma]) { pos_ma = i; } } if (pos_ma < pos_mi) { for (int i = 1; i < n; i++) { dir[i] = !dir[i]; } pos_ma = pos_mi = 1; for (int i = 2; i <= n; i++) { pf[i] = pf[i - 1] + (dir[i - 1] ? 1 : -1) * d1[i - 1]; if (pf[i] < pf[pos_mi]) { pos_mi = i; } if (pf[i] > pf[pos_ma]) { pos_ma = i; } } } for (int i = 1; i <= n; i++) { answer(i, pf[i] - pf[pos_mi] + 1); } }

컴파일 시 표준 에러 (stderr) 메시지

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:24:25: error: 'query' was not declared in this scope
   24 |                 d1[i] = query(i, i + 1);
      |                         ^~~~~
xylophone.cpp:27:25: error: 'query' was not declared in this scope
   27 |                 d2[i] = query(i, i + 2);
      |                         ^~~~~
xylophone.cpp:59:17: error: 'answer' was not declared in this scope
   59 |                 answer(i, pf[i] - pf[pos_mi] + 1);
      |                 ^~~~~~