제출 #503935

#제출 시각아이디문제언어결과실행 시간메모리
503935Abrar_Al_SamitXylophone (JOI18_xylophone)C++17
컴파일 에러
0 ms0 KiB
#include "xylophone.h" #include <bits/stdc++.h> #include "grader.cpp" using namespace std; void solve(int N) { int p = 2; while(query(p, N)==N-1) { ++p; } --p; int ans[n+1]; for(int i=1; i<=N; ++i) { if(i==p) { ans[i] = 1; } else { ans[i] = 1+query(1, p); } } for(int i=1; i<=N; ++i) { answer(i, ans[i]); } }

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

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:15:11: error: 'n' was not declared in this scope
   15 |   int ans[n+1];
      |           ^
xylophone.cpp:18:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |       ans[i] = 1;
      |       ^~~
      |       abs
xylophone.cpp:20:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |       ans[i] = 1+query(1, p);
      |       ^~~
      |       abs
xylophone.cpp:24:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |     answer(i, ans[i]);
      |               ^~~
      |               abs