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<cstdio>
int a[111][111];
int b[111][111];
bool chk(int p,int q,int r,int s,int t,int u)
{
return 1LL*p*s+1LL*r*u+1LL*t*q-1LL*p*u-1LL*r*q-1LL*t*s==0;
}
int main()
{
int i,j,k,l,w,x,y,z,r=0;
scanf("%d%d",&w,&x);
for(i=0;i<w;i++)for(j=0;j<x;j++)scanf("%d",&a[i][j]);
scanf("%d%d",&y,&z);
for(i=0;i<y;i++)for(j=0;j<z;j++)scanf("%d",&b[i][j]);
if(y==1||z==1)
{
printf("%d\n",w*x);
return 0;
}
for(i=0;i<=w-y;i++)for(j=0;j<=x-z;j++)
{
for(k=0;k<y;k++)
{
for(l=0;l<z;l++)if(!chk(a[i][j],b[0][0],a[i][j+1],b[0][1],a[i+k][j+l],b[k][l]))break;
if(l<z)break;
}
if(k==y)r++;
}
printf("%d\n",r);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |