This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
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");
for(j=0;j<k;j++){
printf("%d ",a[0][i+j]);
}
return 0;
}
}
printf("NO");
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |