#include<cstdio>
#include<cmath>
using namespace std;
int a[1005];
int main()
{
int n,m,k,i,j;
while(scanf("%d%d%d",&m,&n,&k)!=EOF)
{
while(k--)
{
int min = 100000,max = -1,f = 1;
for(i = 1;i<=n;i++)
{
scanf("%d",&a[i]);
if(a[i]-i+1>m)f = 0;
if(a[i]>max)min = max = a[i];
else
{
if(a[i]>min)f = 0;
else min = a[i];
}
}
printf("%s\n",f?"YES":"NO");
}
}
return 0;
}
pat 1051 Pop Sequence 解法2
最新推荐文章于 2023-07-18 14:32:14 发布