結果

問題 No.917 Make One With GCD
ユーザー NoneNone
提出日時 2021-04-10 18:48:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 440 ms
コンパイル使用メモリ 86,756 KB
実行使用メモリ 77,516 KB
最終ジャッジ日時 2023-09-08 14:34:19
合計ジャッジ時間 5,242 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
77,184 KB
testcase_01 AC 89 ms
71,360 KB
testcase_02 AC 94 ms
71,868 KB
testcase_03 AC 91 ms
71,672 KB
testcase_04 AC 92 ms
71,508 KB
testcase_05 AC 90 ms
71,600 KB
testcase_06 AC 92 ms
71,892 KB
testcase_07 AC 92 ms
71,940 KB
testcase_08 AC 93 ms
71,728 KB
testcase_09 AC 100 ms
77,188 KB
testcase_10 AC 103 ms
77,464 KB
testcase_11 AC 101 ms
77,352 KB
testcase_12 AC 100 ms
77,248 KB
testcase_13 AC 100 ms
77,512 KB
testcase_14 AC 100 ms
77,480 KB
testcase_15 AC 101 ms
77,516 KB
testcase_16 AC 99 ms
77,448 KB
testcase_17 AC 93 ms
71,652 KB
testcase_18 AC 92 ms
71,744 KB
testcase_19 AC 92 ms
71,828 KB
testcase_20 AC 91 ms
71,728 KB
testcase_21 AC 91 ms
71,680 KB
testcase_22 AC 96 ms
71,676 KB
testcase_23 AC 92 ms
71,532 KB
testcase_24 AC 90 ms
71,804 KB
testcase_25 AC 102 ms
77,408 KB
testcase_26 AC 93 ms
71,876 KB
testcase_27 AC 92 ms
71,548 KB
testcase_28 AC 95 ms
71,508 KB
testcase_29 AC 94 ms
71,524 KB
testcase_30 AC 95 ms
71,720 KB
testcase_31 AC 92 ms
71,724 KB
testcase_32 AC 92 ms
71,568 KB
testcase_33 AC 91 ms
71,904 KB
testcase_34 AC 92 ms
71,860 KB
testcase_35 AC 91 ms
71,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
from math import gcd

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

dp=defaultdict(int)
dp[0]=1
for a in A:
    ndp=defaultdict(int)
    for key,val in dp.items():
        ndp[gcd(key,a)]+=val
        ndp[key]+=val
    dp=ndp

print(dp[1])
0