結果

問題 No.2429 Happiest Tabehodai Ways
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-08-24 20:33:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 871 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 90,240 KB
最終ジャッジ日時 2024-06-02 10:01:10
合計ジャッジ時間 4,649 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
81,920 KB
testcase_01 AC 46 ms
55,168 KB
testcase_02 AC 44 ms
55,168 KB
testcase_03 AC 47 ms
55,552 KB
testcase_04 AC 48 ms
55,424 KB
testcase_05 WA -
testcase_06 AC 48 ms
55,680 KB
testcase_07 WA -
testcase_08 AC 49 ms
55,296 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 76 ms
70,272 KB
testcase_14 WA -
testcase_15 AC 92 ms
71,680 KB
testcase_16 WA -
testcase_17 AC 59 ms
64,128 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 72 ms
68,480 KB
testcase_21 WA -
testcase_22 AC 46 ms
55,808 KB
testcase_23 AC 48 ms
55,296 KB
testcase_24 AC 48 ms
55,168 KB
testcase_25 AC 65 ms
65,664 KB
testcase_26 AC 62 ms
65,920 KB
testcase_27 AC 57 ms
62,976 KB
testcase_28 AC 50 ms
55,936 KB
testcase_29 AC 85 ms
72,704 KB
testcase_30 AC 78 ms
71,808 KB
testcase_31 AC 78 ms
70,144 KB
testcase_32 AC 74 ms
71,296 KB
testcase_33 AC 82 ms
71,936 KB
testcase_34 AC 80 ms
72,576 KB
testcase_35 AC 77 ms
70,272 KB
testcase_36 AC 91 ms
73,600 KB
testcase_37 AC 70 ms
66,304 KB
testcase_38 AC 70 ms
67,968 KB
testcase_39 AC 50 ms
56,320 KB
testcase_40 AC 110 ms
90,240 KB
testcase_41 AC 58 ms
65,024 KB
testcase_42 AC 102 ms
82,304 KB
testcase_43 AC 45 ms
55,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

N,K = map(int,input().split())
C = list(map(int,input().split()))
D = list(map(int,input().split()))

mod = 998244353

dp = [-1]*(K+2)
dp[0] = 0
for i in range(N):
    
    c,d = C[i],D[i]
    
    for j in range(K):
        
        if dp[j]!=-1:
            dp[min(K+1,j+c)] = max(dp[min(K+1,j+c)],dp[j]+d)

e = [[] for _ in range(K+2)]

for i in range(N):
    
    c,d = C[i],D[i]
    
    for j in range(K):
        
        k = min(K+1,j+c)
        if dp[k]-dp[j]==d:
            e[j].append(k)
            

val = [0]*(K+2)

val[0] = 1
for i in range(K):
    
    
    for j in e[i]:
        
        
        val[j] += val[i]
        val[j] %= mod
if dp[K]==-1:
    print(0)
    print(1)
    exit()

print(dp[K])
print(val[K])
0