結果

問題 No.1532 Different Products
ユーザー chineristACchineristAC
提出日時 2021-05-02 03:11:53
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,995 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 82,224 KB
実行使用メモリ 258,124 KB
最終ジャッジ日時 2024-07-21 02:14:48
合計ジャッジ時間 52,775 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
55,936 KB
testcase_01 WA -
testcase_02 AC 48 ms
61,952 KB
testcase_03 AC 47 ms
56,320 KB
testcase_04 AC 45 ms
56,192 KB
testcase_05 AC 46 ms
56,448 KB
testcase_06 AC 62 ms
67,584 KB
testcase_07 AC 64 ms
69,120 KB
testcase_08 AC 69 ms
71,808 KB
testcase_09 AC 174 ms
106,624 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 165 ms
107,136 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 312 ms
155,136 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 394 ms
182,784 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 142 ms
96,128 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 198 ms
77,952 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 AC 45 ms
55,936 KB
testcase_63 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

"""
Dirichlet Product
"""
def mul(N,K,L,data_as,data_ab,data_bs,data_bb):
    data_rs = [0 for i in range(K+1)]
    data_rb = [0 for i in range(L+1)]

    for i in range(1,K+1):
        for j in range(1,K//i+1):
            data_rs[i*j] += data_as[i] * data_bs[j]

    data_as_cum = [data_as[i] for i in range(K+1)]
    data_bs_cum = [data_bs[i] for i in range(K+1)]
    for i in range(1,K+1):
        data_as_cum[i] += data_as_cum[i-1]
        data_bs_cum[i] += data_bs_cum[i-1]

    def cumA(i):
        if 1<=i<=L:
            return data_ab[i]
        else:
            return data_as_cum[(N//i)]

    def cumB(i):
        if 1<=i<=L:
            return data_bb[i]
        else:
            return data_bs_cum[(N//i)]

    for i in range(1,L+1):
        M = int((N//i)**.5)
        for j in range(1,M+1):
            data_rb[i] += data_as[j] * cumB(i*j)
        for j in range(1,M+1):
            data_rb[i] += data_bs[j] * (cumA(i*j)-cumA(N//M))

    return data_rs,data_rb

def single_mul(N,K,L,a,A,val):
    res = [a[i] for i in range(K+1)]
    Res = [A[i] for i in range(L+1)]

    for i in range(1,K+1):
        if i*val<=K:
            res[i*val] += a[i]

    cum = [a[i] for i in range(K+1)]
    for i in range(1,K+1):
        cum[i] += cum[i-1]

    def cumA(i):
        if 1<=i<=L:
            return A[i]
        else:
            return cum[N//i]

    for i in range(1,L+1):
        Res[i] += cumA(i*val)

    return res,Res

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import gcd,log

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

_N,_K = mi()

N = _K
K = int(N**.5) + 1
L = K

res = [0 for i in range(K+1)]
res[1] = 1
Res = [0 for i in range(L+1)]
for i in range(1,L+1):
    Res[i] = 1

for i in range(1,_N+1):
    res,Res = single_mul(N,K,L,res,Res,i)
    #print(res,Res)

print((Res[1]-1) % 998244353)
0