Submission #15387

#TimeUsernameProblemLanguageResultExecution timeMemory
15387gs13068흑백 이미지 찾기 (kriii3_G)C++98
0 / 101
1 ms1180 KiB
#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-y+1)*(x-z+1)); 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...