Submission #1113322


Source Code Expand

N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

ret = False
for i in range(N):
    for j in range(N):
        if i + M > N or j + M > N:
            continue
        f = True
        for k in range(M):
            for l in range(M):
                if A[i + k][j + l] != B[k][l]:
                    f = False
                    break
            if not f:
                break
        if f:
            ret = True
if ret:
    print('Yes')
else:
    print("No")

Submission Info

Submission Time
Task B - Template Matching
User papepi
Language Python (3.4.3)
Score 200
Code Size 535 Byte
Status AC
Exec Time 21 ms
Memory 3064 KiB

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 18 ms 3064 KiB
sample_02.txt AC 17 ms 3064 KiB
subtask_1_01.txt AC 17 ms 3060 KiB
subtask_1_02.txt AC 17 ms 3060 KiB
subtask_1_03.txt AC 17 ms 3060 KiB
subtask_1_04.txt AC 18 ms 3064 KiB
subtask_1_05.txt AC 19 ms 3064 KiB
subtask_1_06.txt AC 18 ms 3064 KiB
subtask_1_07.txt AC 19 ms 3064 KiB
subtask_1_08.txt AC 21 ms 3064 KiB