제출 #256565

#제출 시각아이디문제언어결과실행 시간메모리
256565DavidDamianXylophone (JOI18_xylophone)C++11
컴파일 에러
0 ms0 KiB
//#include "xylophone.h" #include<bits/stdc++.h> using namespace std; ///Subtask 3 ///2N queries ///Ask for i,i+1 and i,i+2 ///Determine the direction of the changes with adj3[i]==adj2[i]+adj2[i+1] int a[5005]; int adj2[5005]; //Differences of pairs int adj3[5005]; //Differences of triples int same[5005]; bool found=false; void build(int n,int k,int dir) { bool one=false; a[1]=k; for(int i=1;i<=n-1;i++){ if(a[i]==1) one=true; if(!same[i]) dir*=-1; a[i+1]=a[i]+dir*adj2[i]; if(a[i+1]<1 || a[i+1]>n) return; if(a[i+1]==n && !one) return; } found=true; } void print(int n) { for(int i=1;i<=n;i++){ answer(i,a[i]); } } void solve(int N) { if(N==2){ answer(1,1); answer(2,2); return; } for(int i=1;i<=N-2;i++){ adj2[i]=query(i,i+1); adj3[i]=query(i,i+2); } adj2[N-1]=query(N-1,N); same[1]=1; for(int i=1;i<=N-2;i++){ if(adj3[i]==adj2[i]+adj2[i+1]) same[i+1]=1; } for(int i=1;i<=N;i++){ build(N,i,1); if(found){ print(N); return; } build(N,i,-1); if(found){ print(N); return; } } }

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

xylophone.cpp: In function 'void print(int)':
xylophone.cpp:31:9: error: 'answer' was not declared in this scope
         answer(i,a[i]);
         ^~~~~~
xylophone.cpp:31:9: note: suggested alternative: 'assert'
         answer(i,a[i]);
         ^~~~~~
         assert
xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:36:9: error: 'answer' was not declared in this scope
         answer(1,1);
         ^~~~~~
xylophone.cpp:36:9: note: suggested alternative: 'assert'
         answer(1,1);
         ^~~~~~
         assert
xylophone.cpp:41:17: error: 'query' was not declared in this scope
         adj2[i]=query(i,i+1);
                 ^~~~~
xylophone.cpp:44:15: error: 'query' was not declared in this scope
     adj2[N-1]=query(N-1,N);
               ^~~~~