結果

問題 No.2429 Happiest Tabehodai Ways
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-08-24 20:33:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 871 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 93,772 KB
最終ジャッジ日時 2023-08-24 20:33:16
合計ジャッジ時間 7,831 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
72,684 KB
testcase_01 AC 104 ms
72,664 KB
testcase_02 AC 113 ms
72,804 KB
testcase_03 AC 108 ms
72,772 KB
testcase_04 WA -
testcase_05 AC 105 ms
72,720 KB
testcase_06 WA -
testcase_07 AC 104 ms
73,052 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 126 ms
78,292 KB
testcase_13 WA -
testcase_14 AC 138 ms
78,572 KB
testcase_15 WA -
testcase_16 AC 111 ms
77,980 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 129 ms
77,892 KB
testcase_20 WA -
testcase_21 AC 104 ms
73,056 KB
testcase_22 AC 107 ms
72,948 KB
testcase_23 AC 110 ms
72,684 KB
testcase_24 AC 120 ms
77,648 KB
testcase_25 AC 123 ms
77,620 KB
testcase_26 AC 115 ms
77,316 KB
testcase_27 AC 108 ms
72,936 KB
testcase_28 AC 138 ms
78,352 KB
testcase_29 AC 130 ms
78,288 KB
testcase_30 AC 123 ms
78,020 KB
testcase_31 AC 126 ms
78,428 KB
testcase_32 AC 133 ms
78,072 KB
testcase_33 AC 132 ms
78,240 KB
testcase_34 AC 126 ms
78,504 KB
testcase_35 AC 141 ms
78,408 KB
testcase_36 AC 125 ms
78,204 KB
testcase_37 AC 124 ms
78,168 KB
testcase_38 AC 107 ms
73,008 KB
testcase_39 AC 165 ms
93,772 KB
testcase_40 AC 116 ms
77,692 KB
testcase_41 AC 153 ms
81,868 KB
testcase_42 AC 104 ms
72,656 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