Submission #1103554


Source Code Expand

#include <stdio.h>

int n, m;
char a[64][64];
char b[64][64];

int same(int y, int x)
{
    int i, j;

    for (i = 0; i < m; ++i){
        for (j = 0; j < m; ++j){
            if (a[y + i][x + j] != b[i][j]){
                return 0;
            }
        }
    }

    return 1;
}

int main(void)
{
    int i, j;

    scanf("%d %d", &n, &m);
    for (i = 0; i < n; ++i) scanf("%s", a[i]);
    for (i = 0; i < m; ++i) scanf("%s", b[i]);

    for (i = 0; i <= n - m; ++i){
        for (j = 0; j <= n - m; ++j){
            if (same(i, j)){
                puts("Yes");
                return 0;
            }
        }
    }

    puts("No");

    return 0;
}

Submission Info

Submission Time
Task B - Template Matching
User ringoh72
Language C (GCC 5.4.1)
Score 200
Code Size 701 Byte
Status AC
Exec Time 1 ms
Memory 128 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:26:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
     ^
./Main.c:27:29: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     for (i = 0; i < n; ++i) scanf("%s", a[i]);
                             ^
./Main.c:28:29: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     for (i = 0; i < m; ++i) scanf("%s", b[i]);
                             ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 10
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All sample_01.txt, sample_02.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 128 KB
sample_02.txt AC 1 ms 128 KB
subtask_1_01.txt AC 1 ms 128 KB
subtask_1_02.txt AC 1 ms 128 KB
subtask_1_03.txt AC 1 ms 128 KB
subtask_1_04.txt AC 1 ms 128 KB
subtask_1_05.txt AC 1 ms 128 KB
subtask_1_06.txt AC 1 ms 128 KB
subtask_1_07.txt AC 1 ms 128 KB
subtask_1_08.txt AC 1 ms 128 KB