#include<stdio.h>
int a[101][1001];
int b[101];
int main(){
int n,k,i,j,p,q;
bool flag1,flag2,flag3,flag4,flag5,flag6;
scanf("%d%d",&n,&k);
for(i=0;i<n;i++){
scanf("%d",&b[i]);
for(j=0;j<b[i];j++){
scanf("%d",&a[i][j]);
}
}
for(i=0;i<b[0]-k+1;i++){
flag1=1;
if(i==2)
int sp=1;
for(j=1;j<n;j++){
flag2=0;
flag3=0;
for(p=0;p<b[j]-k+1;p++){
if(a[0][i]==a[j][p]){
flag2=1;
for(q=0;q<k;q++){
if(a[0][i+q]!=a[j][p+q]){
flag2=0;
break;
}
}
if(flag2)
break;
}
}
for(p=k-1;p<b[j];p++){
if(a[0][i]==a[j][p]){
flag3=1;
for(q=0;q<k;q++){
if(a[0][i+q]!=a[j][p-q]){
flag3=0;
break;
}
}
if(flag3)
break;
}
}
if(flag2==0&&flag3==0)
flag1=0;
}
if(flag1==1){
printf("YES");
return 0;
}
}
printf("NO");
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1280 KB |
Output is correct |
2 |
Correct |
0 ms |
1280 KB |
Output is correct |
3 |
Correct |
0 ms |
1280 KB |
Output is correct |
4 |
Correct |
0 ms |
1280 KB |
Output is correct |
5 |
Correct |
0 ms |
1280 KB |
Output is correct |
6 |
Correct |
0 ms |
1280 KB |
Output is correct |
7 |
Correct |
0 ms |
1280 KB |
Output is correct |
8 |
Correct |
0 ms |
1280 KB |
Output is correct |
9 |
Correct |
0 ms |
1280 KB |
Output is correct |
10 |
Correct |
0 ms |
1280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1280 KB |
Output is correct |
2 |
Correct |
0 ms |
1280 KB |
Output is correct |
3 |
Correct |
0 ms |
1280 KB |
Output is correct |
4 |
Correct |
0 ms |
1280 KB |
Output is correct |
5 |
Correct |
0 ms |
1280 KB |
Output is correct |
6 |
Correct |
0 ms |
1280 KB |
Output is correct |
7 |
Correct |
0 ms |
1280 KB |
Output is correct |
8 |
Correct |
0 ms |
1280 KB |
Output is correct |
9 |
Correct |
0 ms |
1280 KB |
Output is correct |
10 |
Correct |
0 ms |
1280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1280 KB |
Output is correct |
2 |
Correct |
0 ms |
1280 KB |
Output is correct |
3 |
Correct |
0 ms |
1280 KB |
Output is correct |
4 |
Correct |
0 ms |
1280 KB |
Output is correct |
5 |
Correct |
0 ms |
1280 KB |
Output is correct |
6 |
Correct |
0 ms |
1280 KB |
Output is correct |
7 |
Correct |
0 ms |
1280 KB |
Output is correct |
8 |
Correct |
0 ms |
1280 KB |
Output is correct |
9 |
Correct |
0 ms |
1280 KB |
Output is correct |
10 |
Correct |
7 ms |
1280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1280 KB |
Output is correct |
2 |
Correct |
0 ms |
1280 KB |
Output is correct |
3 |
Correct |
0 ms |
1280 KB |
Output is correct |
4 |
Correct |
0 ms |
1280 KB |
Output is correct |
5 |
Correct |
0 ms |
1280 KB |
Output is correct |
6 |
Correct |
0 ms |
1280 KB |
Output is correct |
7 |
Correct |
0 ms |
1280 KB |
Output is correct |
8 |
Correct |
0 ms |
1280 KB |
Output is correct |
9 |
Correct |
23 ms |
1280 KB |
Output is correct |
10 |
Correct |
19 ms |
1280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1280 KB |
Output is correct |
2 |
Correct |
4 ms |
1280 KB |
Output is correct |
3 |
Correct |
4 ms |
1280 KB |
Output is correct |
4 |
Correct |
51 ms |
1280 KB |
Output is correct |
5 |
Correct |
2 ms |
1280 KB |
Output is correct |
6 |
Correct |
7 ms |
1280 KB |
Output is correct |
7 |
Correct |
10 ms |
1280 KB |
Output is correct |
8 |
Correct |
7 ms |
1280 KB |
Output is correct |
9 |
Correct |
14 ms |
1280 KB |
Output is correct |
10 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
1280 KB |
Output is correct |
2 |
Correct |
22 ms |
1280 KB |
Output is correct |
3 |
Correct |
20 ms |
1280 KB |
Output is correct |
4 |
Correct |
20 ms |
1280 KB |
Output is correct |
5 |
Correct |
34 ms |
1280 KB |
Output is correct |
6 |
Correct |
51 ms |
1280 KB |
Output is correct |
7 |
Correct |
59 ms |
1280 KB |
Output is correct |
8 |
Correct |
11 ms |
1280 KB |
Output is correct |
9 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
10 |
Halted |
0 ms |
0 KB |
- |