結果

問題 No.917 Make One With GCD
ユーザー convexineqconvexineq
提出日時 2021-04-20 04:45:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 241 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 77,568 KB
最終ジャッジ日時 2023-09-17 08:36:18
合計ジャッジ時間 6,920 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
77,232 KB
testcase_01 AC 93 ms
71,636 KB
testcase_02 AC 97 ms
72,020 KB
testcase_03 AC 94 ms
71,988 KB
testcase_04 AC 94 ms
71,528 KB
testcase_05 AC 94 ms
71,668 KB
testcase_06 AC 95 ms
71,616 KB
testcase_07 AC 93 ms
71,920 KB
testcase_08 AC 94 ms
71,896 KB
testcase_09 AC 102 ms
77,336 KB
testcase_10 AC 101 ms
77,568 KB
testcase_11 AC 99 ms
77,488 KB
testcase_12 AC 100 ms
77,316 KB
testcase_13 AC 101 ms
77,344 KB
testcase_14 AC 102 ms
77,452 KB
testcase_15 AC 104 ms
77,440 KB
testcase_16 AC 106 ms
77,420 KB
testcase_17 AC 93 ms
72,004 KB
testcase_18 AC 96 ms
71,740 KB
testcase_19 AC 95 ms
71,828 KB
testcase_20 AC 94 ms
71,468 KB
testcase_21 AC 94 ms
71,860 KB
testcase_22 AC 93 ms
71,748 KB
testcase_23 AC 95 ms
71,840 KB
testcase_24 AC 95 ms
71,700 KB
testcase_25 AC 99 ms
77,224 KB
testcase_26 AC 92 ms
71,896 KB
testcase_27 AC 91 ms
71,696 KB
testcase_28 AC 94 ms
71,528 KB
testcase_29 AC 95 ms
71,480 KB
testcase_30 AC 94 ms
71,740 KB
testcase_31 AC 93 ms
71,672 KB
testcase_32 AC 94 ms
71,772 KB
testcase_33 AC 94 ms
71,820 KB
testcase_34 AC 96 ms
72,012 KB
testcase_35 AC 94 ms
71,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
from math import gcd
n = int(input())
*a, = map(int,input().split())
d = defaultdict(int)
d[0] = 1
for ai in a:
    nd = d.copy()
    for k,v in d.items():
        nd[gcd(ai,k)] += v
    d = nd
print(d[1])
0