結果
| 問題 |
No.2211 Frequency Table of GCD
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-02-10 22:26:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 881 bytes |
| コンパイル時間 | 136 ms |
| コンパイル使用メモリ | 82,388 KB |
| 実行使用メモリ | 140,988 KB |
| 最終ジャッジ日時 | 2024-07-07 16:37:06 |
| 合計ジャッジ時間 | 11,669 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 RE * 15 |
ソースコード
def div(n):
if n <= 0:
return []
S = set()
i = 1
while i * i <= n:
if n % i == 0:
S.add(i)
S.add(n // i)
i += 1
return list(S)
N, M = map(int, input().split())
A = list(map(int, input().split()))
mod = 998244353
L = [0] * (M + 1)
D = [0] * (M + 1)
for a in A:
D[a] += 1
dic = dict()
for i in range(1, M + 1):
if D[i] == 0:
continue
dic[i] = div(i)
for d in dic[i]:
L[d] += D[i]
two = [1] * 202020
for i in range(202000):
two[i + 1] = two[i] * 2
two[i + 1] %= mod
ans = [0] * (M + 1)
for i in range(M + 1):
ans[i] = two[L[i]] - 1
for i in range(M, 0, -1):
if ans[i] == 0:
continue
for d in dic[i]:
if d == i:
continue
ans[d] -= ans[i]
ans[d] %= mod
for i in range(1, M + 1):
print(ans[i])
rlangevin