結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー c-yanc-yan
提出日時 2021-06-11 21:50:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 221 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 1,131 ms
コンパイル使用メモリ 86,736 KB
実行使用メモリ 76,772 KB
最終ジャッジ日時 2023-08-21 12:10:44
合計ジャッジ時間 7,703 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,368 KB
testcase_01 AC 72 ms
71,372 KB
testcase_02 AC 72 ms
70,900 KB
testcase_03 AC 89 ms
76,468 KB
testcase_04 AC 84 ms
76,360 KB
testcase_05 AC 81 ms
76,632 KB
testcase_06 AC 81 ms
76,336 KB
testcase_07 AC 81 ms
76,488 KB
testcase_08 AC 82 ms
76,488 KB
testcase_09 AC 79 ms
76,312 KB
testcase_10 AC 83 ms
76,772 KB
testcase_11 AC 84 ms
76,232 KB
testcase_12 AC 83 ms
76,572 KB
testcase_13 AC 80 ms
76,296 KB
testcase_14 AC 84 ms
76,572 KB
testcase_15 AC 80 ms
76,332 KB
testcase_16 AC 82 ms
76,488 KB
testcase_17 AC 82 ms
76,540 KB
testcase_18 AC 78 ms
76,552 KB
testcase_19 AC 81 ms
76,700 KB
testcase_20 AC 82 ms
76,476 KB
testcase_21 AC 81 ms
76,628 KB
testcase_22 AC 81 ms
76,480 KB
testcase_23 AC 80 ms
76,536 KB
testcase_24 AC 78 ms
76,528 KB
testcase_25 AC 81 ms
76,532 KB
testcase_26 AC 85 ms
76,472 KB
testcase_27 AC 81 ms
76,488 KB
testcase_28 AC 86 ms
76,532 KB
testcase_29 AC 81 ms
76,328 KB
testcase_30 AC 81 ms
76,432 KB
testcase_31 AC 81 ms
76,560 KB
testcase_32 AC 81 ms
76,448 KB
testcase_33 AC 220 ms
76,624 KB
testcase_34 AC 73 ms
71,320 KB
testcase_35 AC 71 ms
71,396 KB
testcase_36 AC 77 ms
76,308 KB
testcase_37 AC 75 ms
76,364 KB
testcase_38 AC 210 ms
76,704 KB
testcase_39 AC 211 ms
76,736 KB
testcase_40 AC 211 ms
76,588 KB
testcase_41 AC 214 ms
76,360 KB
testcase_42 AC 208 ms
76,452 KB
testcase_43 AC 213 ms
76,524 KB
testcase_44 AC 216 ms
76,356 KB
testcase_45 AC 221 ms
76,544 KB
testcase_46 AC 217 ms
76,452 KB
testcase_47 AC 220 ms
76,760 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