Submission #15399

#TimeUsernameProblemLanguageResultExecution timeMemory
15399gs13068흑백 이미지 찾기 (kriii3_G)C++98
33 / 101
13 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) { if(p==r&&q!=s)return false; return 1LL*p*s+1LL*r*u+1LL*t*q-1LL*p*u-1LL*r*q-1LL*t*s==0; } int main() { int p,q; 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++) { if(y==1) { p=a[i][j+1]; q=b[0][1]; } else { p=a[i+1][j]; q=b[1][0]; } for(k=0;k<y;k++) { for(l=0;l<z;l++)if(!chk(a[i][j],b[0][0],p,q,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...