제출 #363176

#제출 시각아이디문제언어결과실행 시간메모리
363176teewarXylophone (JOI18_xylophone)C++14
컴파일 에러
0 ms0 KiB
void solve(int n) { int l = 1, r = n; while(r - l > 1) { int m = (l + r) / 2; if(query(1, m) == n - 1) { r = m; } else { l = m; } } int mxpos = r; int a[n + 1]; for(int i = 1; i <= n; ++i) { int val; if(i <= mxpos) { val = query(i, mxpos); } else { val = query(mxpos, i); } a[i] = n - val; } for(int i = 1; i <= n; ++i) { cout << answer(i, a[i]); } }

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

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:5:12: error: 'query' was not declared in this scope
    5 |         if(query(1, m) == n - 1) {
      |            ^~~~~
xylophone.cpp:17:19: error: 'query' was not declared in this scope
   17 |             val = query(i, mxpos);
      |                   ^~~~~
xylophone.cpp:20:19: error: 'query' was not declared in this scope
   20 |             val = query(mxpos, i);
      |                   ^~~~~
xylophone.cpp:25:9: error: 'cout' was not declared in this scope
   25 |         cout << answer(i, a[i]);
      |         ^~~~
xylophone.cpp:25:17: error: 'answer' was not declared in this scope
   25 |         cout << answer(i, a[i]);
      |                 ^~~~~~