結果

問題 No.1036 Make One With GCD 2
ユーザー ああいいああいい
提出日時 2022-03-31 09:37:13
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 410 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 192,808 KB
最終ジャッジ日時 2024-04-28 03:04:25
合計ジャッジ時間 22,972 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 468 ms
192,808 KB
testcase_01 AC 479 ms
174,484 KB
testcase_02 AC 486 ms
160,020 KB
testcase_03 AC 139 ms
101,376 KB
testcase_04 AC 199 ms
121,780 KB
testcase_05 AC 53 ms
53,632 KB
testcase_06 AC 51 ms
53,376 KB
testcase_07 AC 216 ms
102,452 KB
testcase_08 AC 179 ms
104,320 KB
testcase_09 AC 786 ms
172,804 KB
testcase_10 AC 633 ms
161,200 KB
testcase_11 AC 668 ms
173,784 KB
testcase_12 AC 603 ms
162,116 KB
testcase_13 AC 817 ms
178,080 KB
testcase_14 AC 824 ms
187,744 KB
testcase_15 AC 768 ms
174,088 KB
testcase_16 AC 783 ms
174,492 KB
testcase_17 AC 785 ms
177,388 KB
testcase_18 AC 70 ms
68,996 KB
testcase_19 AC 77 ms
69,760 KB
testcase_20 AC 80 ms
71,808 KB
testcase_21 AC 78 ms
71,680 KB
testcase_22 AC 769 ms
173,916 KB
testcase_23 AC 574 ms
138,368 KB
testcase_24 AC 797 ms
175,160 KB
testcase_25 AC 731 ms
162,112 KB
testcase_26 AC 751 ms
170,700 KB
testcase_27 AC 47 ms
53,376 KB
testcase_28 AC 46 ms
53,376 KB
testcase_29 AC 46 ms
53,376 KB
testcase_30 AC 46 ms
53,632 KB
testcase_31 AC 48 ms
54,016 KB
testcase_32 AC 49 ms
54,400 KB
testcase_33 AC 46 ms
53,504 KB
testcase_34 AC 50 ms
54,144 KB
testcase_35 AC 46 ms
53,632 KB
testcase_36 AC 46 ms
53,376 KB
testcase_37 AC 46 ms
53,376 KB
testcase_38 TLE -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def gcd(a,b):
    if b == 0:return a
    while True:
        r = a % b
        a = b
        b = r
        if r == 0:return a
from collections import defaultdict
d = defaultdict(int)
count = 0
d[0] = 1
for a in A:
    e = defaultdict(int)
    for k in d:
        g = gcd(k,a)
        e[g] += d[k]
    count += e[1]
    e[0] += 1
    d = e
print(count)
    
0