제출 #210274

#제출 시각아이디문제언어결과실행 시간메모리
210274eric_xiaoXylophone (JOI18_xylophone)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; ll A[100009],lf[100009],lf2[100009]; void solve(ll N) { ll i,j,k,mn = 1000000000; vector<ll> ck; A[1] = 0; A[2] = A[1]+query(1,2); ck.push_back(A[1]); ck.push_back(A[2]); mn = min(A[1],A[2]); for(i = 3;i <= N;i++) { lf[i] = query(i-1,i); lf2[i] = query(i-2,i); A[i] = A[i-1]+lf[i]; if(max({A[i],A[i-1],A[i-2]}) - min({A[i],A[i-1],A[i-2]}) != lf2[i]) { A[i] = A[i-1] - lf[i]; } mn = min(mn,A[i]); } ll cg = 0,sm = 0; for(i = 1;i <= N;i++) { A[i] = A[i] - mn + 1; if(A[i] == 1) sm = 1; if(A[i] == N) { if(sm == 1) cg = 1; } } if(cg == 1) { for(i = 1;i <= N;i++) { A[i] = N + 1 - A[i]; } } for(i = 1;i <= N;i++) { answer(i,A[i]); } }

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

xylophone.cpp: In function 'void solve(long long int)':
xylophone.cpp:10:17: error: 'query' was not declared in this scope
     A[2] = A[1]+query(1,2);
                 ^~~~~
xylophone.cpp:44:9: error: 'answer' was not declared in this scope
         answer(i,A[i]);
         ^~~~~~
xylophone.cpp:44:9: note: suggested alternative: 'assert'
         answer(i,A[i]);
         ^~~~~~
         assert
xylophone.cpp:7:10: warning: unused variable 'j' [-Wunused-variable]
     ll i,j,k,mn = 1000000000;
          ^
xylophone.cpp:7:12: warning: unused variable 'k' [-Wunused-variable]
     ll i,j,k,mn = 1000000000;
            ^