結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
72,860 KB
testcase_01 AC 104 ms
72,868 KB
testcase_02 AC 105 ms
72,656 KB
testcase_03 AC 105 ms
73,040 KB
testcase_04 AC 103 ms
72,820 KB
testcase_05 AC 105 ms
73,044 KB
testcase_06 AC 105 ms
73,132 KB
testcase_07 AC 131 ms
72,800 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 132 ms
78,236 KB
testcase_13 WA -
testcase_14 AC 139 ms
78,532 KB
testcase_15 WA -
testcase_16 AC 131 ms
77,936 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 124 ms
77,916 KB
testcase_20 WA -
testcase_21 AC 104 ms
72,832 KB
testcase_22 AC 105 ms
72,880 KB
testcase_23 AC 105 ms
72,792 KB
testcase_24 AC 117 ms
77,624 KB
testcase_25 AC 127 ms
77,556 KB
testcase_26 AC 111 ms
77,496 KB
testcase_27 AC 106 ms
73,012 KB
testcase_28 AC 134 ms
78,232 KB
testcase_29 AC 131 ms
78,232 KB
testcase_30 AC 125 ms
78,168 KB
testcase_31 AC 127 ms
78,268 KB
testcase_32 AC 134 ms
78,204 KB
testcase_33 AC 161 ms
78,264 KB
testcase_34 AC 125 ms
78,612 KB
testcase_35 AC 141 ms
78,380 KB
testcase_36 AC 122 ms
78,280 KB
testcase_37 AC 125 ms
77,988 KB
testcase_38 AC 105 ms
73,200 KB
testcase_39 AC 166 ms
93,868 KB
testcase_40 AC 117 ms
77,544 KB
testcase_41 AC 168 ms
81,596 KB
testcase_42 AC 104 ms
72,680 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)

# print(dp)

val[0] = 1
for i in range(K):
    
    
    for j in e[i]:
        
        
        val[j] += val[i]
        val[j] %= mod

for j in range(K,-1,-1):
    if dp[j]!=-1:
        print(dp[j])
        print(val[j])
        exit()

print(0)
print(1)
0