結果

問題 No.2211 Frequency Table of GCD
ユーザー prussian_coderprussian_coder
提出日時 2023-02-13 21:42:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 350 bytes
コンパイル時間 959 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 99,800 KB
最終ジャッジ日時 2023-09-23 13:37:35
合計ジャッジ時間 6,388 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,052 KB
testcase_01 AC 71 ms
71,008 KB
testcase_02 AC 65 ms
71,012 KB
testcase_03 AC 140 ms
83,252 KB
testcase_04 AC 144 ms
88,176 KB
testcase_05 AC 159 ms
94,356 KB
testcase_06 AC 148 ms
86,532 KB
testcase_07 AC 167 ms
93,740 KB
testcase_08 AC 76 ms
82,032 KB
testcase_09 AC 76 ms
79,544 KB
testcase_10 AC 86 ms
88,896 KB
testcase_11 AC 83 ms
84,572 KB
testcase_12 AC 89 ms
90,556 KB
testcase_13 AC 135 ms
86,084 KB
testcase_14 AC 160 ms
85,680 KB
testcase_15 AC 146 ms
85,172 KB
testcase_16 AC 147 ms
86,912 KB
testcase_17 AC 153 ms
92,380 KB
testcase_18 AC 186 ms
99,760 KB
testcase_19 AC 192 ms
99,776 KB
testcase_20 AC 200 ms
99,688 KB
testcase_21 AC 195 ms
99,800 KB
testcase_22 AC 190 ms
99,504 KB
testcase_23 AC 145 ms
83,640 KB
testcase_24 AC 179 ms
98,428 KB
testcase_25 AC 95 ms
92,384 KB
testcase_26 AC 67 ms
71,272 KB
testcase_27 AC 182 ms
99,792 KB
testcase_28 AC 183 ms
98,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=[int(x) for x in input().split()]
B=[0]*M
mod=998244353
for i in range(N):
	B[A[i]-1]+=1
C=[0]*M
for i in range(M):
	x=i+1
	t=1
	while x*t<=M:
		C[i]+=B[x*t-1]
		t+=1
ans=[0]*M
for i in reversed(range(M)):
	a=pow(2,C[i],mod)-1
	x=i+1
	t=2
	while t*x<=M:
		a-=ans[t*x-1]
		a%=mod
		t+=1
	ans[i]=a
[print(a) for a in ans]
0