結果

問題 No.917 Make One With GCD
ユーザー shotoyooshotoyoo
提出日時 2021-07-22 10:47:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 530 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 76,076 KB
最終ジャッジ日時 2023-09-24 13:49:51
合計ジャッジ時間 5,071 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
76,076 KB
testcase_01 AC 72 ms
71,220 KB
testcase_02 AC 72 ms
71,324 KB
testcase_03 AC 72 ms
71,224 KB
testcase_04 AC 73 ms
71,404 KB
testcase_05 AC 72 ms
71,424 KB
testcase_06 AC 75 ms
71,216 KB
testcase_07 AC 74 ms
71,176 KB
testcase_08 AC 74 ms
71,120 KB
testcase_09 AC 78 ms
75,908 KB
testcase_10 AC 78 ms
75,960 KB
testcase_11 AC 78 ms
75,808 KB
testcase_12 AC 80 ms
75,892 KB
testcase_13 AC 79 ms
76,000 KB
testcase_14 AC 79 ms
76,060 KB
testcase_15 AC 79 ms
76,028 KB
testcase_16 AC 80 ms
75,748 KB
testcase_17 AC 75 ms
70,952 KB
testcase_18 AC 75 ms
71,388 KB
testcase_19 AC 73 ms
71,400 KB
testcase_20 AC 75 ms
71,400 KB
testcase_21 AC 73 ms
71,232 KB
testcase_22 AC 74 ms
71,228 KB
testcase_23 AC 75 ms
71,384 KB
testcase_24 AC 75 ms
71,232 KB
testcase_25 AC 80 ms
75,912 KB
testcase_26 AC 76 ms
71,100 KB
testcase_27 AC 73 ms
71,368 KB
testcase_28 AC 74 ms
71,328 KB
testcase_29 AC 73 ms
71,280 KB
testcase_30 AC 75 ms
71,128 KB
testcase_31 AC 73 ms
71,444 KB
testcase_32 AC 74 ms
71,220 KB
testcase_33 AC 73 ms
71,272 KB
testcase_34 AC 72 ms
71,228 KB
testcase_35 AC 73 ms
71,420 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.get(1,0)
print(ans)
0