結果

問題 No.917 Make One With GCD
ユーザー rlangevinrlangevin
提出日時 2023-01-31 23:29:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 717 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 77,524 KB
最終ジャッジ日時 2023-09-13 15:07:35
合計ジャッジ時間 6,060 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
77,336 KB
testcase_01 AC 94 ms
71,680 KB
testcase_02 AC 91 ms
71,600 KB
testcase_03 AC 94 ms
71,776 KB
testcase_04 AC 92 ms
71,360 KB
testcase_05 AC 91 ms
71,424 KB
testcase_06 AC 90 ms
71,656 KB
testcase_07 AC 90 ms
71,736 KB
testcase_08 AC 88 ms
71,720 KB
testcase_09 AC 101 ms
77,056 KB
testcase_10 AC 100 ms
77,176 KB
testcase_11 AC 99 ms
77,484 KB
testcase_12 AC 101 ms
77,172 KB
testcase_13 AC 102 ms
77,304 KB
testcase_14 AC 98 ms
77,524 KB
testcase_15 AC 100 ms
77,212 KB
testcase_16 AC 96 ms
77,096 KB
testcase_17 AC 89 ms
71,868 KB
testcase_18 AC 91 ms
71,492 KB
testcase_19 AC 89 ms
71,452 KB
testcase_20 AC 90 ms
71,636 KB
testcase_21 AC 93 ms
71,240 KB
testcase_22 AC 88 ms
71,624 KB
testcase_23 AC 91 ms
71,356 KB
testcase_24 AC 89 ms
71,708 KB
testcase_25 AC 98 ms
77,232 KB
testcase_26 AC 89 ms
71,840 KB
testcase_27 AC 92 ms
71,556 KB
testcase_28 AC 99 ms
71,392 KB
testcase_29 AC 93 ms
71,552 KB
testcase_30 AC 94 ms
71,652 KB
testcase_31 AC 98 ms
71,708 KB
testcase_32 AC 92 ms
71,420 KB
testcase_33 AC 92 ms
71,624 KB
testcase_34 AC 95 ms
71,600 KB
testcase_35 AC 94 ms
71,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
from collections import *

N = int(input())
A = list(map(int, input().split()))
pre = defaultdict(int)
pre[0] = 1
for a in A:
    dp = defaultdict(int)
    for k, v in pre.items():
        dp[gcd(k, a)] += v
        dp[k] += v
    dp, pre = pre, dp
print(pre[1])
0