結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー hiragnhiragn
提出日時 2022-11-25 17:43:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 703 ms / 2,000 ms
コード長 307 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 82,464 KB
実行使用メモリ 62,680 KB
最終ジャッジ日時 2024-04-09 23:52:34
合計ジャッジ時間 10,272 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,796 KB
testcase_01 AC 43 ms
52,672 KB
testcase_02 AC 39 ms
52,224 KB
testcase_03 AC 44 ms
60,304 KB
testcase_04 AC 44 ms
60,524 KB
testcase_05 AC 44 ms
61,968 KB
testcase_06 AC 45 ms
61,064 KB
testcase_07 AC 46 ms
61,756 KB
testcase_08 AC 43 ms
61,356 KB
testcase_09 AC 46 ms
59,972 KB
testcase_10 AC 44 ms
60,624 KB
testcase_11 AC 44 ms
61,008 KB
testcase_12 AC 46 ms
61,004 KB
testcase_13 AC 45 ms
60,744 KB
testcase_14 AC 47 ms
61,688 KB
testcase_15 AC 46 ms
61,444 KB
testcase_16 AC 45 ms
59,712 KB
testcase_17 AC 44 ms
60,436 KB
testcase_18 AC 43 ms
58,820 KB
testcase_19 AC 44 ms
61,252 KB
testcase_20 AC 45 ms
61,148 KB
testcase_21 AC 44 ms
60,140 KB
testcase_22 AC 44 ms
60,372 KB
testcase_23 AC 46 ms
61,016 KB
testcase_24 AC 44 ms
62,016 KB
testcase_25 AC 45 ms
62,680 KB
testcase_26 AC 44 ms
61,072 KB
testcase_27 AC 45 ms
60,948 KB
testcase_28 AC 45 ms
61,140 KB
testcase_29 AC 45 ms
61,372 KB
testcase_30 AC 45 ms
61,248 KB
testcase_31 AC 44 ms
60,964 KB
testcase_32 AC 44 ms
61,804 KB
testcase_33 AC 44 ms
61,220 KB
testcase_34 AC 37 ms
52,936 KB
testcase_35 AC 37 ms
53,556 KB
testcase_36 AC 44 ms
59,844 KB
testcase_37 AC 43 ms
61,444 KB
testcase_38 AC 703 ms
62,108 KB
testcase_39 AC 700 ms
61,920 KB
testcase_40 AC 703 ms
61,016 KB
testcase_41 AC 700 ms
61,552 KB
testcase_42 AC 696 ms
61,360 KB
testcase_43 AC 667 ms
60,820 KB
testcase_44 AC 670 ms
61,424 KB
testcase_45 AC 699 ms
61,212 KB
testcase_46 AC 680 ms
61,784 KB
testcase_47 AC 682 ms
61,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math


def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    for i in range(m * n // math.gcd(m, n)):
        if a[i % n] == b[i % m]:
            exit(print(i + 1))
    print(-1)


if __name__ == "__main__":
    main()
0