結果

問題 No.917 Make One With GCD
ユーザー tamatotamato
提出日時 2020-05-04 23:25:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 516 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 87,740 KB
実行使用メモリ 78,108 KB
最終ジャッジ日時 2023-09-06 16:49:11
合計ジャッジ時間 5,055 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
77,760 KB
testcase_01 AC 90 ms
71,944 KB
testcase_02 AC 89 ms
72,008 KB
testcase_03 AC 96 ms
72,048 KB
testcase_04 AC 91 ms
72,204 KB
testcase_05 AC 92 ms
72,236 KB
testcase_06 AC 91 ms
72,072 KB
testcase_07 AC 89 ms
72,052 KB
testcase_08 AC 91 ms
71,580 KB
testcase_09 AC 101 ms
77,668 KB
testcase_10 AC 101 ms
77,772 KB
testcase_11 AC 103 ms
77,928 KB
testcase_12 AC 100 ms
77,968 KB
testcase_13 AC 101 ms
78,108 KB
testcase_14 AC 100 ms
77,484 KB
testcase_15 AC 100 ms
77,764 KB
testcase_16 AC 101 ms
77,688 KB
testcase_17 AC 90 ms
72,072 KB
testcase_18 AC 96 ms
76,576 KB
testcase_19 AC 90 ms
71,800 KB
testcase_20 AC 90 ms
71,888 KB
testcase_21 AC 96 ms
76,516 KB
testcase_22 AC 91 ms
71,668 KB
testcase_23 AC 98 ms
76,740 KB
testcase_24 AC 97 ms
76,972 KB
testcase_25 AC 99 ms
76,856 KB
testcase_26 AC 91 ms
72,244 KB
testcase_27 AC 89 ms
72,028 KB
testcase_28 AC 91 ms
72,204 KB
testcase_29 AC 90 ms
71,892 KB
testcase_30 AC 91 ms
71,948 KB
testcase_31 AC 91 ms
71,804 KB
testcase_32 AC 90 ms
72,244 KB
testcase_33 AC 94 ms
72,024 KB
testcase_34 AC 91 ms
72,168 KB
testcase_35 AC 97 ms
72,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    from collections import defaultdict
    input = sys.stdin.readline

    def gcd(a, b):
        while a%b:
            a, b = b, a%b
        return b

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

    G = defaultdict(int)
    for a in A:
        tmp = []
        for v in G:
            tmp.append((gcd(v, a), G[v]))
        for x, y in tmp:
            G[x] += y
        G[a] += 1
    print(G[1])


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