結果

問題 No.2211 Frequency Table of GCD
ユーザー ygd.ygd.
提出日時 2023-02-10 22:17:28
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,028 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 106,664 KB
最終ジャッジ日時 2023-09-21 23:33:23
合計ジャッジ時間 6,536 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
73,320 KB
testcase_01 AC 113 ms
72,956 KB
testcase_02 AC 113 ms
73,140 KB
testcase_03 AC 1,835 ms
106,664 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
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline #文字列はダメ
#sys.setrecursionlimit(1000000)
import math
import bisect
#import itertools
#import random
#from heapq import heapify, heappop, heappush
from collections import defaultdict
from collections import deque
import copy #DeepCopy: hoge = [_[:] for _ in hogehoge]
#from functools import lru_cache
#@lru_cache(maxsize=None)
#MOD = pow(10,9) + 7
MOD = 998244353
dx = [1,0,-1,0]
dy = [0,1,0,-1]
#dx8 = [1,1,0,-1,-1,-1,0,1]
#dy8 = [0,1,1,1,0,-1,-1,-1]

def main():
    N,M = map(int,input().split())
    A = list(map(int,input().split()))

    dic = defaultdict(int)

    for a in A:
        pdic = copy.copy(dic)
        pdic,dic = dic,pdic
        for v,n in pdic.items():
            # print(a,v)
            dic[math.gcd(a,v)] += n %MOD
            dic[math.gcd(a,v)] %= MOD
        dic[a] += 1
        dic[a] %= MOD
        # print(dic)
    
    for i in range(1,M+1):
        print(dic[i])
        


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