結果

問題 No.2075 GCD Subsequence
ユーザー Akijin_007Akijin_007
提出日時 2022-09-16 22:47:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 591 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 115,768 KB
最終ジャッジ日時 2023-08-23 16:20:20
合計ジャッジ時間 7,588 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
91,648 KB
testcase_01 AC 103 ms
91,628 KB
testcase_02 AC 106 ms
91,944 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 104 ms
91,748 KB
testcase_30 AC 104 ms
91,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#int(input())
#map(int, input().split())
#list(map(int, input().split()))

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

m = 10 ** 6 + 10

p = [1] * m
for i in range(2, m):
    if p[i] != 1:
        continue
    for j in range(1, m):
        if i * j >= m:
            break
        p[i*j] = i

a = [0] * m
dp = [1] * (N)

for i in range(N):
    b = A[i]
    s = set()
    while b != 1:
        t = p[b]
        s.add(t)
        b //= t
    for x in s:
        dp[i] = (dp[i] + a[x]) % mod
    for x in s:
        a[x] = (a[x] + dp[i]) % mod

print(sum(dp) % mod)



0