結果

問題 No.2211 Frequency Table of GCD
ユーザー qibqib
提出日時 2023-03-26 01:00:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 481 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 81,768 KB
実行使用メモリ 111,208 KB
最終ジャッジ日時 2023-10-19 08:54:20
合計ジャッジ時間 7,263 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,272 KB
testcase_01 AC 38 ms
53,272 KB
testcase_02 AC 39 ms
53,272 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 56 ms
73,364 KB
testcase_09 AC 52 ms
68,980 KB
testcase_10 AC 70 ms
89,844 KB
testcase_11 AC 61 ms
80,608 KB
testcase_12 AC 70 ms
92,852 KB
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 AC 78 ms
97,864 KB
testcase_26 AC 39 ms
53,280 KB
testcase_27 AC 177 ms
108,720 KB
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

n, m = map(int, input().split())
a = list(map(int, input().split()))

cnt = [0 for _ in range(m + 1)]
for x in a:
  cnt[x] += 1

mul = [0 for _ in range(m + 1)]
for x in range(1, m + 1):
  if cnt[x] == 0:
    continue
  for y in range(x, m + 1, x):
    mul[x] += cnt[y]

dp = [0 for _ in range(m + 1)]
for x in range(m, 0, -1):
  dp[x] = (pow(2, mul[x], MOD) - 1) % MOD
  for y in range(2 * x, m + 1, x):
    dp[x] = (dp[x] - dp[y]) % MOD

print(*dp[1:], sep="\n")
0