#include<bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#define pb push_back
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define pii pair <int,int>
#define PII pair<pii , pii>
#define ld long double
#define sz(v) (int)v.size()
#define rep(i , a , b) for(int i=a;i <= (b);i++)
#define per(i , a , b) for(int i=a;i >= (b);i--)
using namespace std ;
const int maxn = 1e6 + 10 , inf= 2e9 , mod = 1e9 + 7 , sq = 360 ,MX = 20000 ;
int p[maxn] , a[maxn] , d[maxn] , nd[maxn] ;
void solve(int n){
rep(i , 1, n-1){
d[i] = query(i , i+1) ;
nd[i] = d[i] ;
}
rep(i , 1, n-2){
if(d[i]+d[i+1]!=query(i ,i+2)){
if(nd[i]>0)nd[i+1] = -d[i+1] ;
}else{
if(nd[i]<0)nd[i+1] = -d[i+1] ;
}
}
int mn= 0 ;
p[1] =0 ;
rep(i , 2, n){
p[i] = p[i-1] + nd[i-1] ;
mn = min(mn , p[i]) ;
}
rep(i , 1, n){
p[i]+=-mn+1;
}
rep(i , 1, n){
if(p[i] == n){
rep(i , 1, n){
p[i] = n+1 - p[i] ;
}
break ;
}
if(p[i]==1)break ;
}
rep(i ,1 , n){
answer(i , p[i]) ;
}
}
Compilation message
xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:20:16: error: 'query' was not declared in this scope
20 | d[i] = query(i , i+1) ;
| ^~~~~
xylophone.cpp:24:25: error: 'query' was not declared in this scope
24 | if(d[i]+d[i+1]!=query(i ,i+2)){
| ^~~~~
xylophone.cpp:49:9: error: 'answer' was not declared in this scope
49 | answer(i , p[i]) ;
| ^~~~~~