結果

問題 No.2211 Frequency Table of GCD
ユーザー rlangevinrlangevin
提出日時 2023-02-10 22:23:49
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 811 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 112,692 KB
最終ジャッジ日時 2023-09-21 23:38:39
合計ジャッジ時間 32,728 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
77,780 KB
testcase_01 AC 81 ms
77,548 KB
testcase_02 AC 80 ms
77,472 KB
testcase_03 AC 1,123 ms
84,180 KB
testcase_04 AC 1,063 ms
92,700 KB
testcase_05 AC 1,366 ms
102,744 KB
testcase_06 AC 1,276 ms
88,728 KB
testcase_07 AC 1,640 ms
100,612 KB
testcase_08 AC 89 ms
87,704 KB
testcase_09 AC 89 ms
83,320 KB
testcase_10 AC 102 ms
100,088 KB
testcase_11 AC 95 ms
92,916 KB
testcase_12 AC 106 ms
103,344 KB
testcase_13 AC 975 ms
89,300 KB
testcase_14 AC 1,414 ms
87,572 KB
testcase_15 AC 1,207 ms
84,392 KB
testcase_16 AC 1,340 ms
87,140 KB
testcase_17 AC 1,320 ms
100,036 KB
testcase_18 AC 1,980 ms
110,508 KB
testcase_19 TLE -
testcase_20 AC 1,980 ms
110,696 KB
testcase_21 TLE -
testcase_22 TLE -
testcase_23 AC 1,277 ms
84,128 KB
testcase_24 AC 1,310 ms
112,692 KB
testcase_25 AC 111 ms
106,376 KB
testcase_26 AC 82 ms
77,704 KB
testcase_27 TLE -
testcase_28 AC 1,300 ms
110,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def div(n):
    if n <= 0:
        return []
    S = set()
    i = 1
    while i * i <= n:
        if n % i == 0:
            S.add(i)
            S.add(n // i)
        i += 1
    return list(S)

N, M = map(int, input().split())
A = list(map(int, input().split()))
mod = 998244353
L = [0] * (M + 1)
D = [0] * (M + 1)
for a in A:
    D[a] += 1
    
for i in range(1, M + 1):
    if D[i] == 0:
        continue
    for d in div(i):
        L[d] += D[i]
        
two = [1] * 202020
for i in range(202000):
    two[i + 1] = two[i] * 2
    two[i + 1] %= mod
    
ans = [0] * (M + 1)
for i in range(M + 1):
    ans[i] = two[L[i]] - 1
    
for i in range(M, 0, -1):
    for d in div(i):
        if d == i:
            continue
        ans[d] -= ans[i]
        ans[d] %= mod

for i in range(1, M + 1):
    print(ans[i])
0