結果

問題 No.2211 Frequency Table of GCD
ユーザー meruuu61779999meruuu61779999
提出日時 2023-02-10 21:54:16
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 785 bytes
コンパイル時間 1,878 ms
コンパイル使用メモリ 86,836 KB
実行使用メモリ 155,292 KB
最終ジャッジ日時 2023-09-21 23:05:33
合計ジャッジ時間 6,437 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
76,008 KB
testcase_01 AC 97 ms
71,504 KB
testcase_02 AC 95 ms
71,376 KB
testcase_03 AC 1,764 ms
132,052 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
from collections import defaultdict

inputs = sys.stdin.readline

"""再帰関数のときセット
sys.setrecursionlimit(10**7)
import pypyjit
pypyjit.set_param('max_unroll_recursion=-1')
"""

MOD = 998244353


def main():
    N, M = map(int, inputs().split())
    A = list(map(int, inputs().split()))
    after_dic = defaultdict(int)

    for a in A:
        before_dic, after_dic = after_dic, defaultdict(int)
        for GCD, cnt in before_dic.items():
            after_dic[GCD] += cnt
            after_dic[GCD] %= MOD
            GCD2 = math.gcd(GCD, a)
            after_dic[GCD2] += cnt
            after_dic[GCD2] %= MOD
        after_dic[a] += 1

    for i in range(1, M + 1):
        print(after_dic[i] % MOD)


if __name__ == '__main__':
    main()
0