結果

問題 No.2211 Frequency Table of GCD
ユーザー minimumminimum
提出日時 2023-02-10 23:30:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 214 ms / 2,000 ms
コード長 514 bytes
コンパイル時間 823 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 109,400 KB
最終ジャッジ日時 2023-09-22 01:17:40
合計ジャッジ時間 7,239 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,204 KB
testcase_01 AC 76 ms
70,816 KB
testcase_02 AC 74 ms
71,388 KB
testcase_03 AC 165 ms
80,604 KB
testcase_04 AC 165 ms
92,580 KB
testcase_05 AC 186 ms
102,600 KB
testcase_06 AC 169 ms
88,424 KB
testcase_07 AC 191 ms
100,360 KB
testcase_08 AC 91 ms
85,640 KB
testcase_09 AC 86 ms
81,604 KB
testcase_10 AC 107 ms
98,152 KB
testcase_11 AC 98 ms
91,156 KB
testcase_12 AC 109 ms
101,196 KB
testcase_13 AC 159 ms
89,180 KB
testcase_14 AC 171 ms
87,872 KB
testcase_15 AC 162 ms
84,544 KB
testcase_16 AC 170 ms
87,368 KB
testcase_17 AC 180 ms
99,652 KB
testcase_18 AC 211 ms
109,028 KB
testcase_19 AC 210 ms
109,176 KB
testcase_20 AC 210 ms
109,172 KB
testcase_21 AC 214 ms
109,184 KB
testcase_22 AC 209 ms
109,108 KB
testcase_23 AC 156 ms
80,596 KB
testcase_24 AC 199 ms
109,288 KB
testcase_25 AC 111 ms
104,256 KB
testcase_26 AC 74 ms
71,160 KB
testcase_27 AC 209 ms
109,032 KB
testcase_28 AC 199 ms
109,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
N, M = map(int, input().split())
A = list(map(int, input().split()))
cnt = [0] * (M + 1)
for i in range(N):
    cnt[A[i]] += 1

for i in range(1, M + 1):
    j = 2 * i
    while j <= M:
        cnt[i] += cnt[j]
        cnt[i] %= MOD
        j += i
    cnt[i] = (pow(2, cnt[i], MOD) - 1) % MOD

ans = [0] * (M + 1)
for i in range(M, 0, -1):
    ans[i] = cnt[i]
    j = 2 * i
    while j <= M:
        ans[i] -= ans[j]
        ans[i] %= MOD
        j += i

for i in range(1, M + 1):
    print(ans[i])
0