結果

問題 No.2211 Frequency Table of GCD
ユーザー ニックネームニックネーム
提出日時 2023-02-10 21:59:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,561 ms / 2,000 ms
コード長 396 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 111,336 KB
最終ジャッジ日時 2023-09-22 01:08:23
合計ジャッジ時間 20,696 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
71,524 KB
testcase_01 AC 82 ms
71,836 KB
testcase_02 AC 82 ms
71,516 KB
testcase_03 AC 159 ms
86,588 KB
testcase_04 AC 578 ms
93,036 KB
testcase_05 AC 893 ms
103,188 KB
testcase_06 AC 521 ms
89,352 KB
testcase_07 AC 875 ms
100,704 KB
testcase_08 AC 123 ms
86,816 KB
testcase_09 AC 113 ms
82,380 KB
testcase_10 AC 167 ms
99,284 KB
testcase_11 AC 141 ms
92,072 KB
testcase_12 AC 170 ms
102,588 KB
testcase_13 AC 479 ms
90,324 KB
testcase_14 AC 494 ms
89,872 KB
testcase_15 AC 350 ms
87,896 KB
testcase_16 AC 472 ms
89,028 KB
testcase_17 AC 801 ms
100,344 KB
testcase_18 AC 1,297 ms
111,336 KB
testcase_19 AC 1,475 ms
111,092 KB
testcase_20 AC 1,299 ms
110,988 KB
testcase_21 AC 1,299 ms
110,964 KB
testcase_22 AC 1,306 ms
110,960 KB
testcase_23 AC 146 ms
86,820 KB
testcase_24 AC 1,545 ms
111,196 KB
testcase_25 AC 119 ms
104,724 KB
testcase_26 AC 81 ms
71,384 KB
testcase_27 AC 1,445 ms
111,128 KB
testcase_28 AC 1,561 ms
111,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
a = list(map(int,input().split()))
mod = 998244353
c = [0]*(m+1); ans = [0]*(m+1)
for v in a:
    for i in range(1,int(v**0.5)+1):
        if not v%i:
            c[i] += 1; c[v//i] += 1
            if v==i*i: c[i] -= 1
for v in range(m,0,-1):
    ans[v] = pow(2,c[v],mod)-1
    for i in range(2*v,m+1,v): ans[v] -= ans[i]
    ans[v] %= mod
print(*ans[1:],sep="\n")
0