delete pics to save space

This commit is contained in:
2023-08-03 09:22:52 +08:00
commit de60cd6ed4
1334 changed files with 66221 additions and 0 deletions

View File

@ -0,0 +1,28 @@
#include<cstdio>
int top=0,n,*sr,*stack;
void check()
{
int *p=sr;
for(int i=1;i<=n;i++)
{
if(*p==i)
{
p++;
while(top>0&&stack[top-1]==*p) p++,top--;
continue;
}
else stack[top++]=i;
}
while(top>0&&stack[top-1]==*p) p++,top--;
if(top==0) printf("YES\n");
else printf("NO\n");
}
int main()
{
scanf("%d",&n);
sr=new int[n];
stack=new int[n+5];
for(int i=0;i<n;i++) scanf("%d",sr+i);
check();
return 0;
}