結果

問題 No.2429 Happiest Tabehodai Ways
ユーザー rlangevinrlangevin
提出日時 2023-09-18 15:34:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 630 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 76,676 KB
最終ジャッジ日時 2023-09-18 15:34:22
合計ジャッジ時間 6,296 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
76,656 KB
testcase_01 AC 84 ms
76,196 KB
testcase_02 AC 115 ms
76,116 KB
testcase_03 AC 82 ms
76,244 KB
testcase_04 AC 85 ms
76,300 KB
testcase_05 AC 78 ms
71,244 KB
testcase_06 AC 85 ms
76,328 KB
testcase_07 AC 83 ms
76,432 KB
testcase_08 AC 86 ms
76,544 KB
testcase_09 AC 86 ms
76,328 KB
testcase_10 AC 89 ms
76,476 KB
testcase_11 AC 87 ms
76,320 KB
testcase_12 AC 88 ms
76,544 KB
testcase_13 AC 97 ms
76,668 KB
testcase_14 AC 96 ms
76,504 KB
testcase_15 AC 99 ms
76,500 KB
testcase_16 AC 90 ms
76,264 KB
testcase_17 AC 89 ms
76,468 KB
testcase_18 AC 93 ms
76,560 KB
testcase_19 AC 92 ms
76,284 KB
testcase_20 AC 92 ms
76,564 KB
testcase_21 WA -
testcase_22 AC 87 ms
76,016 KB
testcase_23 AC 88 ms
76,332 KB
testcase_24 AC 88 ms
76,296 KB
testcase_25 AC 90 ms
76,048 KB
testcase_26 AC 91 ms
76,264 KB
testcase_27 AC 90 ms
76,400 KB
testcase_28 AC 92 ms
76,340 KB
testcase_29 AC 94 ms
76,024 KB
testcase_30 AC 95 ms
76,516 KB
testcase_31 AC 92 ms
76,340 KB
testcase_32 AC 100 ms
76,576 KB
testcase_33 AC 94 ms
76,512 KB
testcase_34 AC 95 ms
76,456 KB
testcase_35 AC 95 ms
76,460 KB
testcase_36 AC 103 ms
76,632 KB
testcase_37 AC 89 ms
76,672 KB
testcase_38 AC 96 ms
76,676 KB
testcase_39 AC 80 ms
71,408 KB
testcase_40 AC 97 ms
76,464 KB
testcase_41 AC 87 ms
76,272 KB
testcase_42 AC 107 ms
76,468 KB
testcase_43 AC 79 ms
71,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
C = list(map(int, input().split()))
D = list(map(int, input().split()))
M = 1005
inf = 10 ** 18
mod = 998244353
dp = [-inf] * M
dp_n = [0] * M
dp[0] = 0
dp_n[0] = 1

for i in range(M):
    for c, d in zip(C, D):
        if i - c >= 0:
            if dp[i - c] + d > dp[i]:
                dp[i] = dp[i - c] + d
                dp_n[i] = dp_n[i - c]
            elif dp[i - c] + d == dp[i]:
                dp_n[i] += dp_n[i - c]
                dp_n[i] %= mod
    
ans = -1
num = 0
for i in range(K + 1):
    if dp[i] > ans:
        ans = dp[i]
        num = dp_n[i]
        
print(ans)
print(num)
0