結果

問題 No.2211 Frequency Table of GCD
ユーザー flygonflygon
提出日時 2023-02-10 22:30:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 753 ms
コンパイル使用メモリ 87,332 KB
実行使用メモリ 110,696 KB
最終ジャッジ日時 2023-09-22 01:13:28
合計ジャッジ時間 7,265 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,316 KB
testcase_01 AC 77 ms
71,320 KB
testcase_02 AC 76 ms
71,404 KB
testcase_03 AC 158 ms
86,308 KB
testcase_04 AC 169 ms
92,692 KB
testcase_05 AC 184 ms
102,628 KB
testcase_06 AC 170 ms
88,752 KB
testcase_07 AC 190 ms
100,704 KB
testcase_08 AC 92 ms
85,964 KB
testcase_09 AC 91 ms
81,348 KB
testcase_10 AC 109 ms
98,144 KB
testcase_11 AC 97 ms
90,976 KB
testcase_12 AC 107 ms
101,148 KB
testcase_13 AC 153 ms
89,576 KB
testcase_14 AC 168 ms
88,680 KB
testcase_15 AC 166 ms
87,340 KB
testcase_16 AC 166 ms
88,404 KB
testcase_17 AC 175 ms
100,240 KB
testcase_18 AC 212 ms
110,132 KB
testcase_19 AC 209 ms
110,236 KB
testcase_20 AC 210 ms
110,120 KB
testcase_21 AC 209 ms
110,228 KB
testcase_22 AC 210 ms
110,384 KB
testcase_23 AC 155 ms
86,696 KB
testcase_24 AC 194 ms
110,696 KB
testcase_25 AC 111 ms
104,480 KB
testcase_26 AC 80 ms
71,364 KB
testcase_27 AC 200 ms
110,460 KB
testcase_28 AC 194 ms
110,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
a = list(map(int,input().split()))
mod = 998244353
cnt = [0]*(m+10)
for i in range(n):
  cnt[a[i]] += 1

ans = [0]*(m+1)

for i in range(1, m+1)[::-1]:
  tmp = 0
  for j in range(i, m+1, i):
    tmp += cnt[j]
  mn = 0
  for j in range(i,m+1, i):
    mn += ans[j]
  ans[i] = pow(2, tmp, mod) - 1 - mn
  ans[i] %= mod

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