結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー uir0uir0
提出日時 2021-06-11 21:42:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 805 ms / 2,000 ms
コード長 368 bytes
コンパイル時間 1,073 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 76,256 KB
最終ジャッジ日時 2023-08-21 11:58:14
合計ジャッジ時間 13,198 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,132 KB
testcase_01 AC 70 ms
71,208 KB
testcase_02 AC 70 ms
71,008 KB
testcase_03 AC 75 ms
75,872 KB
testcase_04 AC 76 ms
75,884 KB
testcase_05 AC 75 ms
75,708 KB
testcase_06 AC 75 ms
75,672 KB
testcase_07 AC 76 ms
75,816 KB
testcase_08 AC 75 ms
76,084 KB
testcase_09 AC 76 ms
76,020 KB
testcase_10 AC 75 ms
76,088 KB
testcase_11 AC 75 ms
75,888 KB
testcase_12 AC 75 ms
75,880 KB
testcase_13 AC 75 ms
75,964 KB
testcase_14 AC 75 ms
75,764 KB
testcase_15 AC 75 ms
75,716 KB
testcase_16 AC 75 ms
75,768 KB
testcase_17 AC 75 ms
75,724 KB
testcase_18 AC 75 ms
75,808 KB
testcase_19 AC 74 ms
76,208 KB
testcase_20 AC 75 ms
75,832 KB
testcase_21 AC 75 ms
75,840 KB
testcase_22 AC 75 ms
75,884 KB
testcase_23 AC 75 ms
75,920 KB
testcase_24 AC 75 ms
75,824 KB
testcase_25 AC 75 ms
75,724 KB
testcase_26 AC 73 ms
75,932 KB
testcase_27 AC 76 ms
75,876 KB
testcase_28 AC 75 ms
75,792 KB
testcase_29 AC 75 ms
75,808 KB
testcase_30 AC 74 ms
75,776 KB
testcase_31 AC 74 ms
75,800 KB
testcase_32 AC 74 ms
76,024 KB
testcase_33 AC 75 ms
75,876 KB
testcase_34 AC 70 ms
71,352 KB
testcase_35 AC 70 ms
71,352 KB
testcase_36 AC 75 ms
75,796 KB
testcase_37 AC 74 ms
76,092 KB
testcase_38 AC 801 ms
75,928 KB
testcase_39 AC 805 ms
76,008 KB
testcase_40 AC 800 ms
75,720 KB
testcase_41 AC 801 ms
75,804 KB
testcase_42 AC 784 ms
75,936 KB
testcase_43 AC 760 ms
75,696 KB
testcase_44 AC 767 ms
76,256 KB
testcase_45 AC 790 ms
75,632 KB
testcase_46 AC 776 ms
76,028 KB
testcase_47 AC 781 ms
75,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def gcd(x, y):
    while y:
        x, y = y, x%y
    return x

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

    for i in range(N*M//gcd(N, M)):
        if A[i%N] == B[i%M]:
            print(i+1)
            break
    else:
        print("-1")

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