結果

問題 No.917 Make One With GCD
ユーザー shotoyooshotoyoo
提出日時 2021-07-22 10:46:37
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 494 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 79,036 KB
最終ジャッジ日時 2023-09-24 13:49:42
合計ジャッジ時間 6,353 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
75,992 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 70 ms
71,396 KB
testcase_04 AC 70 ms
71,128 KB
testcase_05 AC 70 ms
71,564 KB
testcase_06 RE -
testcase_07 AC 70 ms
71,536 KB
testcase_08 RE -
testcase_09 AC 76 ms
75,992 KB
testcase_10 AC 74 ms
76,064 KB
testcase_11 AC 75 ms
75,980 KB
testcase_12 AC 77 ms
76,228 KB
testcase_13 AC 75 ms
76,336 KB
testcase_14 AC 74 ms
76,072 KB
testcase_15 AC 76 ms
75,996 KB
testcase_16 AC 77 ms
76,224 KB
testcase_17 AC 75 ms
71,284 KB
testcase_18 AC 71 ms
71,148 KB
testcase_19 AC 71 ms
71,064 KB
testcase_20 AC 70 ms
71,444 KB
testcase_21 AC 70 ms
71,444 KB
testcase_22 AC 69 ms
71,584 KB
testcase_23 AC 71 ms
71,300 KB
testcase_24 AC 71 ms
71,428 KB
testcase_25 AC 76 ms
76,112 KB
testcase_26 AC 70 ms
71,424 KB
testcase_27 AC 72 ms
71,428 KB
testcase_28 AC 69 ms
71,204 KB
testcase_29 RE -
testcase_30 AC 69 ms
71,192 KB
testcase_31 RE -
testcase_32 AC 69 ms
71,132 KB
testcase_33 AC 68 ms
71,384 KB
testcase_34 RE -
testcase_35 AC 71 ms
71,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))


n = int(input())
a = list(map(int, input().split()))
d = {0:1}
from math import gcd
for i in range(n):
    v = a[i]
    nd = dict(d)
    for k,val in d.items():
        nk = gcd(k, v)
        nd.setdefault(nk, 0)
        nd[nk] += val
    d = nd
ans = d[1]
print(ans)
0