Submission #15386

# Submission time Handle Problem Language Result Execution time Memory
15386 2015-07-12T07:01:06 Z gs13068 흑백 이미지 찾기 (kriii3_G) C++
0 / 101
2 ms 1180 KB
#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
1 Correct 0 ms 1180 KB Output is correct
2 Correct 0 ms 1180 KB Output is correct
3 Incorrect 2 ms 1180 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -