結果

問題 No.2211 Frequency Table of GCD
ユーザー ShirotsumeShirotsume
提出日時 2022-12-18 16:50:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 345 ms / 2,000 ms
コード長 757 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 109,596 KB
最終ジャッジ日時 2023-09-22 00:56:45
合計ジャッジ時間 9,697 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
73,616 KB
testcase_01 AC 120 ms
73,384 KB
testcase_02 AC 119 ms
73,596 KB
testcase_03 AC 288 ms
89,544 KB
testcase_04 AC 268 ms
95,988 KB
testcase_05 AC 290 ms
103,524 KB
testcase_06 AC 282 ms
91,872 KB
testcase_07 AC 307 ms
103,628 KB
testcase_08 AC 131 ms
88,212 KB
testcase_09 AC 127 ms
83,392 KB
testcase_10 AC 145 ms
100,460 KB
testcase_11 AC 139 ms
93,168 KB
testcase_12 AC 151 ms
103,452 KB
testcase_13 AC 258 ms
92,240 KB
testcase_14 AC 301 ms
90,484 KB
testcase_15 AC 286 ms
89,124 KB
testcase_16 AC 293 ms
90,256 KB
testcase_17 AC 293 ms
103,088 KB
testcase_18 AC 338 ms
109,596 KB
testcase_19 AC 344 ms
109,432 KB
testcase_20 AC 338 ms
109,144 KB
testcase_21 AC 345 ms
109,528 KB
testcase_22 AC 344 ms
109,452 KB
testcase_23 AC 288 ms
90,232 KB
testcase_24 AC 333 ms
109,580 KB
testcase_25 AC 154 ms
107,060 KB
testcase_26 AC 119 ms
73,388 KB
testcase_27 AC 321 ms
109,384 KB
testcase_28 AC 319 ms
109,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
sys.setrecursionlimit(5 * 10 ** 5)
from pypyjit import set_param
set_param('max_unroll_recursion=-1')
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353
import random
n, m = mi()
a = li()
count = [0] * (m + 1)

for v in a:
    count[v] += 1

gcount = [0] * (m + 1)
for i in range(1, m + 1):
    for j in range(i, m + 1, i):
        gcount[i] += count[j]

g = [0] * (m + 1)

for i in range(1, m + 1):
    g[i] = pow(2, gcount[i], mod) - 1
    g[i] %= mod


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

for v in g[1:]:
    print(v)
0