結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー c-yanc-yan
提出日時 2021-06-11 21:50:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 189 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 64,384 KB
最終ジャッジ日時 2024-05-08 17:29:33
合計ジャッジ時間 5,265 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,224 KB
testcase_01 AC 38 ms
51,712 KB
testcase_02 AC 38 ms
52,096 KB
testcase_03 AC 52 ms
63,104 KB
testcase_04 AC 52 ms
63,388 KB
testcase_05 AC 48 ms
61,568 KB
testcase_06 AC 48 ms
62,336 KB
testcase_07 AC 49 ms
63,092 KB
testcase_08 AC 54 ms
62,848 KB
testcase_09 AC 49 ms
61,824 KB
testcase_10 AC 51 ms
63,232 KB
testcase_11 AC 52 ms
63,232 KB
testcase_12 AC 52 ms
62,336 KB
testcase_13 AC 47 ms
61,056 KB
testcase_14 AC 52 ms
63,616 KB
testcase_15 AC 48 ms
62,208 KB
testcase_16 AC 51 ms
61,824 KB
testcase_17 AC 52 ms
62,336 KB
testcase_18 AC 47 ms
60,672 KB
testcase_19 AC 48 ms
61,312 KB
testcase_20 AC 48 ms
62,464 KB
testcase_21 AC 47 ms
61,056 KB
testcase_22 AC 50 ms
61,952 KB
testcase_23 AC 48 ms
62,976 KB
testcase_24 AC 47 ms
62,336 KB
testcase_25 AC 50 ms
63,360 KB
testcase_26 AC 52 ms
64,384 KB
testcase_27 AC 49 ms
62,592 KB
testcase_28 AC 52 ms
63,744 KB
testcase_29 AC 48 ms
62,720 KB
testcase_30 AC 49 ms
62,464 KB
testcase_31 AC 50 ms
63,104 KB
testcase_32 AC 48 ms
62,720 KB
testcase_33 AC 189 ms
62,848 KB
testcase_34 AC 39 ms
51,840 KB
testcase_35 AC 38 ms
51,840 KB
testcase_36 AC 46 ms
61,312 KB
testcase_37 AC 43 ms
60,160 KB
testcase_38 AC 179 ms
62,976 KB
testcase_39 AC 179 ms
62,976 KB
testcase_40 AC 180 ms
62,976 KB
testcase_41 AC 179 ms
62,464 KB
testcase_42 AC 176 ms
63,032 KB
testcase_43 AC 183 ms
63,232 KB
testcase_44 AC 184 ms
63,616 KB
testcase_45 AC 188 ms
63,616 KB
testcase_46 AC 184 ms
63,616 KB
testcase_47 AC 186 ms
63,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

INF = 10 ** 15

N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

result = INF
for i in range(N):
    a = A[i]
    for j in range(M):
        x = i + j * N
        if x > result:
            break
        b = B[x % M]
        if a != b:
            continue
        result = min(result, x)
        break
if result == INF:
    print(-1)
else:
    print(result + 1)
0