#include <stdio.h>
#include <stdlib.h>
int main() {
int M
, N
, K
;
scanf("%d %d %d",&M
,&N
,&K
);
int stack
[N
],test
[N
],top
,num
,j
;
while(K
--) {
stack
[0]=0;
top
=0;
num
=1;
j
=0;
for(int i
=0; i
<N
; i
++) {
scanf("%d",&test
[i
]);
}
while(j
<N
) {
if(stack
[top
]>test
[j
]) {
break;
}
while(stack
[top
]<test
[j
]) {
stack
[++top
]=num
++;
}
if(top
>M
) break;
if(stack
[top
]==test
[j
]){
top
--;
}
j
++;
}
if(j
==N
)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
转载请注明原文地址:https://ipadbbs.8miu.com/read-31241.html