結果

問題 No.2211 Frequency Table of GCD
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-02-10 22:38:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 393 bytes
コンパイル時間 570 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 110,848 KB
最終ジャッジ日時 2023-09-22 01:15:17
合計ジャッジ時間 7,133 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
79,852 KB
testcase_01 AC 117 ms
79,784 KB
testcase_02 AC 118 ms
79,756 KB
testcase_03 AC 166 ms
81,312 KB
testcase_04 AC 170 ms
93,804 KB
testcase_05 AC 202 ms
103,608 KB
testcase_06 AC 182 ms
89,292 KB
testcase_07 AC 202 ms
101,052 KB
testcase_08 AC 140 ms
89,584 KB
testcase_09 AC 131 ms
85,024 KB
testcase_10 AC 149 ms
101,888 KB
testcase_11 AC 140 ms
94,920 KB
testcase_12 AC 150 ms
104,992 KB
testcase_13 AC 162 ms
90,552 KB
testcase_14 AC 183 ms
88,012 KB
testcase_15 AC 179 ms
84,884 KB
testcase_16 AC 190 ms
87,996 KB
testcase_17 AC 202 ms
100,492 KB
testcase_18 AC 200 ms
110,684 KB
testcase_19 AC 193 ms
110,580 KB
testcase_20 AC 193 ms
110,664 KB
testcase_21 AC 195 ms
110,848 KB
testcase_22 AC 193 ms
110,656 KB
testcase_23 AC 137 ms
80,816 KB
testcase_24 AC 184 ms
110,540 KB
testcase_25 AC 156 ms
107,872 KB
testcase_26 AC 119 ms
79,768 KB
testcase_27 AC 186 ms
110,792 KB
testcase_28 AC 183 ms
110,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ma = 2*10**5+1

divs = [0]*ma
dp = [0]*ma
for a in A:
    divs[a] += 1

for i in range(1,ma)[::-1]:
    count = 0
    num = 0
    for j in range(i,ma,i):
        count += divs[j]
        num += dp[j]
        num %= mod
    dp[i] = pow(2,count,mod)-1-num
    dp[i] %= mod
for i in range(1,m+1):
    print(dp[i])
0