結果

問題 No.2211 Frequency Table of GCD
ユーザー とりゐとりゐ
提出日時 2023-02-10 21:54:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 192 ms / 2,000 ms
コード長 411 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 87,380 KB
実行使用メモリ 111,080 KB
最終ジャッジ日時 2023-09-22 01:05:59
合計ジャッジ時間 6,445 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,372 KB
testcase_01 AC 67 ms
71,128 KB
testcase_02 AC 69 ms
71,656 KB
testcase_03 AC 141 ms
80,596 KB
testcase_04 AC 147 ms
92,692 KB
testcase_05 AC 167 ms
102,728 KB
testcase_06 AC 151 ms
88,532 KB
testcase_07 AC 172 ms
100,344 KB
testcase_08 AC 82 ms
85,984 KB
testcase_09 AC 79 ms
81,372 KB
testcase_10 AC 97 ms
98,276 KB
testcase_11 AC 86 ms
90,988 KB
testcase_12 AC 98 ms
101,480 KB
testcase_13 AC 143 ms
89,464 KB
testcase_14 AC 156 ms
87,664 KB
testcase_15 AC 146 ms
84,444 KB
testcase_16 AC 151 ms
87,348 KB
testcase_17 AC 162 ms
99,764 KB
testcase_18 AC 192 ms
110,772 KB
testcase_19 AC 190 ms
110,824 KB
testcase_20 AC 190 ms
110,904 KB
testcase_21 AC 191 ms
110,516 KB
testcase_22 AC 192 ms
110,872 KB
testcase_23 AC 143 ms
80,768 KB
testcase_24 AC 182 ms
110,936 KB
testcase_25 AC 99 ms
104,312 KB
testcase_26 AC 69 ms
71,456 KB
testcase_27 AC 186 ms
110,876 KB
testcase_28 AC 182 ms
111,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
input=lambda :stdin.readline()[:-1]

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

c=[0]*(m+1)
for i in a:
  c[i]+=1

mod=998244353
res=[0]*(m+1)
for i in range(1,m+1):
  cnt=0
  for j in range(i,m+1,i):
    cnt+=c[j]
  res[i]=pow(2,cnt,mod)-1

for i in range(m,0,-1):
  for j in range(2*i,m+1,i):
    res[i]-=res[j]
    res[i]%=mod

for i in range(1,m+1):
  print(res[i])
0