結果

問題 No.2763 Macaron Gift Box
ユーザー rlangevin
提出日時 2024-05-17 22:59:04
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 700 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 82,108 KB
実行使用メモリ 285,016 KB
最終ジャッジ日時 2024-12-20 15:00:41
合計ジャッジ時間 41,872 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 TLE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

N, K = map(int, input().split())
Q = deque()
for i in range(1, N + 1):
    L = defaultdict(int)
    cnt = 1
    for j in range(0, N + 1, i):
        if cnt == K + 2:
            break
        L[j] = 1
        cnt += 1        
    Q.append(L)
    
mod = 998244353
def merge(x, y):
    new = defaultdict(int)
    for kx, cx in x.items():
        for ky, cy in y.items():
            if kx + ky > N:
                continue
            new[kx + ky] += (cx * cy) % mod
    return new    

while len(Q) >= 2:
    a = Q.popleft()
    b = Q.popleft()
    c = merge(a, b)
    Q.append(c)
    
ans = [0] * (N + 1)
for k, v in Q[0].items():
    ans[k] = v % mod
    
print(*ans[1:])
0