提出 #62292324


ソースコード 拡げる

Copy
N, M = map(int, input().split())
S = [list(input()) for _ in range(N)]
T = [list(input()) for _ in range(M)]
B = []
for i in range(N):
for j in range(N - M + 1):
if S[i][j:j+M] == T[0]:
B.append((j, i))
for x, iy in B:
if iy + M > N: continue
for oy in range(M):
y = iy + oy
if S[y][x:x+M] != T[oy]:
break
else:
print(iy + 1, x + 1)
exit()
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
N, M = map(int, input().split())
S = [list(input()) for _ in range(N)]
T = [list(input()) for _ in range(M)]

B = []

for i in range(N):
    for j in range(N - M + 1):
        if S[i][j:j+M] == T[0]:
            B.append((j, i))

for x, iy in B:
    if iy + M > N: continue
    for oy in range(M):
        y = iy + oy
        if S[y][x:x+M] != T[oy]:
            break
    else:
        print(iy + 1, x + 1)
        exit()

提出情報

提出日時
問題 B - Seek Grid
ユーザ KNSN92
言語 Python (PyPy 3.10-v7.3.12)
得点 200
コード長 441 Byte
結果 AC
実行時間 63 ms
メモリ 81808 KB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 2
AC × 26
セット名 テストケース
Sample 00_sample_01.txt, 00_sample_02.txt
All 00_sample_01.txt, 00_sample_02.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt
ケース名 結果 実行時間 メモリ
00_sample_01.txt AC 59 ms 76824 KB
00_sample_02.txt AC 59 ms 76588 KB
01_random_01.txt AC 59 ms 76516 KB
01_random_02.txt AC 63 ms 80920 KB
01_random_03.txt AC 59 ms 76568 KB
01_random_04.txt AC 59 ms 76476 KB
01_random_05.txt AC 61 ms 76660 KB
01_random_06.txt AC 62 ms 80908 KB
01_random_07.txt AC 59 ms 76488 KB
01_random_08.txt AC 62 ms 81200 KB
01_random_09.txt AC 59 ms 76720 KB
01_random_10.txt AC 62 ms 81324 KB
01_random_11.txt AC 59 ms 76660 KB
01_random_12.txt AC 59 ms 76592 KB
01_random_13.txt AC 59 ms 76520 KB
01_random_14.txt AC 62 ms 81808 KB
01_random_15.txt AC 61 ms 81084 KB
01_random_16.txt AC 62 ms 81296 KB
01_random_17.txt AC 59 ms 76520 KB
01_random_18.txt AC 60 ms 76400 KB
01_random_19.txt AC 62 ms 81016 KB
01_random_20.txt AC 61 ms 80968 KB
02_handmade_01.txt AC 59 ms 76564 KB
02_handmade_02.txt AC 59 ms 76352 KB
02_handmade_03.txt AC 59 ms 76532 KB
02_handmade_04.txt AC 60 ms 76536 KB


2025-04-09 (水)
21:02:54 +00:00