답안 #15399

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
15399 2015-07-12T07:06:23 Z gs13068 흑백 이미지 찾기 (kriii3_G) C++
33 / 101
13 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)
{
    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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1180 KB Output is correct
2 Correct 0 ms 1180 KB Output is correct
3 Correct 0 ms 1180 KB Output is correct
4 Correct 0 ms 1180 KB Output is correct
5 Correct 0 ms 1180 KB Output is correct
6 Correct 0 ms 1180 KB Output is correct
7 Correct 0 ms 1180 KB Output is correct
8 Correct 0 ms 1180 KB Output is correct
9 Correct 2 ms 1180 KB Output is correct
10 Correct 0 ms 1180 KB Output is correct
11 Correct 0 ms 1180 KB Output is correct
12 Correct 0 ms 1180 KB Output is correct
13 Correct 2 ms 1180 KB Output is correct
14 Correct 4 ms 1180 KB Output is correct
15 Correct 10 ms 1180 KB Output is correct
16 Correct 2 ms 1180 KB Output is correct
17 Correct 0 ms 1180 KB Output is correct
18 Correct 0 ms 1180 KB Output is correct
19 Correct 1 ms 1180 KB Output is correct
20 Correct 1 ms 1180 KB Output is correct
21 Correct 10 ms 1180 KB Output is correct
22 Correct 8 ms 1180 KB Output is correct
23 Correct 5 ms 1180 KB Output is correct
24 Correct 2 ms 1180 KB Output is correct
25 Correct 0 ms 1180 KB Output is correct
26 Correct 1 ms 1180 KB Output is correct
27 Correct 1 ms 1180 KB Output is correct
28 Correct 0 ms 1180 KB Output is correct
29 Correct 1 ms 1180 KB Output is correct
30 Correct 0 ms 1180 KB Output is correct
31 Correct 1 ms 1180 KB Output is correct
32 Correct 1 ms 1180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 13 ms 1176 KB futex (syscall #202) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -