struct Queue
{
int q[maxn];
int qh,qt;
void Init()
{
memset ( q , 0 , sizeof(q) );
qh = 1;
qt = 0;
}
void Push( int x )
{
q[++qt] = x;
while ( qt>qh&&f[q[qt]]<=f[q[qt-1]] )
q[qt-1]=q[qt],q[qt--]=0;
}
void Move( int x , int len )
{
if ( q[qh]+len-1<x )
q[qh++] = 0;
}
int Top()
{
return q[qh];
}
}Q;