//
#include<bits/stdc++.h>
using namespace std;
const int N=1111;
int in[N];
stack<int> sk;
int main()
{
int n,i,cnt;
while( cin>>n )
{
if( n==0 ) break;
for( i=0;i<n;i++ ) cin>>in[i];
cnt=1;
for( i=0;i<n;i++ )
{
while( !sk.empty() && sk.top()==cnt ) { cnt++; sk.pop(); }
sk.push( in[i] );
while( !sk.empty() && sk.top()==cnt ) { cnt++; sk.pop(); }
}
if( cnt==n+1 ) cout<<"yes"<<endl;
else cout<<"no"<<endl;
}
return 0;
}
VJ_ Street Parade_stack
猜你喜欢
转载自blog.csdn.net/qq_63173957/article/details/124406798
今日推荐
周排行