#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
const int MAXN = 1000 +10;
int n;
int target[MAXN];
int main()
{
while(scanf("%d",&n)&&n)
{
while(scanf("%d",&target[1])&&target[1])
{
int stack[MAXN],top = 0;
int A= 1,B=1;
for(int i=2; i<=n; i++)
scanf("%d",&target[i]);
int ok = 1;
while(B<=n)
{
if(A == target[B]){ A++;B++; }
else if(top&&stack[top]==target[B]){top--; B++; }
else if(A <= n)stack[++top]=A++;
else {ok = 0; break;}
}
printf("%s\n",ok?"Yes":"No");
}
if(n)printf("\n");
}
system("pause");
return 0;
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。