제출 #210289

#제출 시각아이디문제언어결과실행 시간메모리
210289casperwangXylophone (JOI18_xylophone)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 5000;
int m;
int a[MAXN+1];
int d[MAXN+1];
bool p[MAXN+1];

void solve(int n) {
  for (int i = 2; i <= n; i++)
    d[i] = query(i-1, i);
  for (int i = 3; i <= n; i++) {
    if (d[i-1] + d[i] == query(i-2, i)) {
      p[i] = p[i-1];
    } else p[i] = !p[i-1];
  }
  for (int i = 2; i <= n; i++) {
    if (p[i]) a[i] = a[i-1] + d[i];
    else a[i] = a[i-1] - d[i];
    m = min(m, a[i]);
  }
  for (int i = 1; i <= n; i++)
    a[i] = a[i] - m + 1;
  bool tf = 0, t = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 1) t = 1;
    if (a[i] == n && !t) tf = 1;
  }
  if (tf)
    for (int i = 1; i <= n; i++)
      a[i] = n - a[i] + 1;
  for (int i = 1; i <= n; i++)
    answer(i, a[i]);
}

signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  return 0;
}

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

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:12:12: error: 'query' was not declared in this scope
     d[i] = query(i-1, i);
            ^~~~~
xylophone.cpp:14:26: error: 'query' was not declared in this scope
     if (d[i-1] + d[i] == query(i-2, i)) {
                          ^~~~~
xylophone.cpp:34:5: error: 'answer' was not declared in this scope
     answer(i, a[i]);
     ^~~~~~
xylophone.cpp:34:5: note: suggested alternative: 'assert'
     answer(i, a[i]);
     ^~~~~~
     assert