結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー mkawa2mkawa2
提出日時 2021-09-03 17:42:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 209 ms / 2,000 ms
コード長 761 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 86,744 KB
実行使用メモリ 76,432 KB
最終ジャッジ日時 2023-08-21 15:28:12
合計ジャッジ時間 7,475 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,300 KB
testcase_01 AC 69 ms
71,348 KB
testcase_02 AC 68 ms
71,348 KB
testcase_03 AC 84 ms
76,056 KB
testcase_04 AC 75 ms
76,308 KB
testcase_05 AC 74 ms
76,156 KB
testcase_06 AC 75 ms
76,384 KB
testcase_07 AC 75 ms
76,356 KB
testcase_08 AC 79 ms
76,376 KB
testcase_09 AC 78 ms
76,404 KB
testcase_10 AC 79 ms
76,072 KB
testcase_11 AC 80 ms
76,160 KB
testcase_12 AC 79 ms
76,068 KB
testcase_13 AC 78 ms
76,388 KB
testcase_14 AC 79 ms
76,344 KB
testcase_15 AC 81 ms
76,212 KB
testcase_16 AC 77 ms
76,164 KB
testcase_17 AC 75 ms
76,220 KB
testcase_18 AC 77 ms
76,308 KB
testcase_19 AC 76 ms
76,312 KB
testcase_20 AC 76 ms
76,340 KB
testcase_21 AC 75 ms
76,068 KB
testcase_22 AC 76 ms
76,052 KB
testcase_23 AC 74 ms
76,052 KB
testcase_24 AC 75 ms
76,228 KB
testcase_25 AC 76 ms
76,068 KB
testcase_26 AC 75 ms
76,188 KB
testcase_27 AC 76 ms
76,432 KB
testcase_28 AC 76 ms
76,184 KB
testcase_29 AC 76 ms
76,300 KB
testcase_30 AC 77 ms
76,268 KB
testcase_31 AC 77 ms
76,384 KB
testcase_32 AC 75 ms
76,168 KB
testcase_33 AC 189 ms
76,332 KB
testcase_34 AC 71 ms
71,112 KB
testcase_35 AC 71 ms
71,132 KB
testcase_36 AC 76 ms
76,160 KB
testcase_37 AC 76 ms
76,056 KB
testcase_38 AC 208 ms
76,212 KB
testcase_39 AC 206 ms
76,392 KB
testcase_40 AC 207 ms
76,060 KB
testcase_41 AC 208 ms
76,176 KB
testcase_42 AC 209 ms
76,060 KB
testcase_43 AC 200 ms
76,176 KB
testcase_44 AC 202 ms
76,056 KB
testcase_45 AC 207 ms
76,156 KB
testcase_46 AC 203 ms
76,056 KB
testcase_47 AC 205 ms
76,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**9
# md = 998244353
md = 10**9+7

n, m = LI()
aa = LI()
bb = LI()

for ij in range(n*m):
    i, j = ij%n, ij%m
    if aa[i] == bb[j]:
        print(ij+1)
        exit()

print(-1)
0