제출 #763315

#제출 시각아이디문제언어결과실행 시간메모리
763315vjudge1Xylophone (JOI18_xylophone)C++17
컴파일 에러
0 ms0 KiB
#include "xylophone.h" #include <bits/stdc++.h> using namespace std; #define ll long long void solve(int N){ cin>>N; vector<int> duo(N+1,0); vector<int> trio(N+1,0); vector<int> arr(N+1,0); for(int i=1;i<N;++i){ duo[i-1] = ask(i,i+1); } arr[1] = duo[0]; for(int i=2;i<N;++i){ trio[i-2] = ask(i-1,i+1); } bool greater = true; for(int i=2;i<N;++i){ if(trio[i-2] == duo[i-1] + duo[i-2]){ greater = !greater; } arr[i] = arr[i-1] + duo[i-1] * ((int)greater * 2 - 1); } int maxi = 0, mini = 0; int maxpos = 0, minpos = 0; for(int i=1;i<N;++i){ if(arr[i] > maxi){ maxi = arr[i]; maxpos = i; } if(arr[i] < mini){ mini = arr[i]; minpos = i; } } if(minpos < maxpos){ for(int i=0;i<N;++i){ answer(i+1,arr[i]-mini + 1); } } else{ for(int i=0;i<N;++i){ answer(i+1,maxi - arr[i] + 1); } } }

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

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:11:14: error: 'ask' was not declared in this scope
   11 |   duo[i-1] = ask(i,i+1);
      |              ^~~
xylophone.cpp:15:15: error: 'ask' was not declared in this scope
   15 |   trio[i-2] = ask(i-1,i+1);
      |               ^~~