結果

問題 No.2429 Happiest Tabehodai Ways
ユーザー ramdosramdos
提出日時 2023-08-18 14:16:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 641 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-05-06 17:58:00
合計ジャッジ時間 6,360 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 433 ms
11,008 KB
testcase_01 AC 28 ms
10,880 KB
testcase_02 AC 28 ms
10,880 KB
testcase_03 AC 29 ms
10,880 KB
testcase_04 AC 28 ms
10,880 KB
testcase_05 WA -
testcase_06 AC 29 ms
10,880 KB
testcase_07 WA -
testcase_08 AC 27 ms
10,880 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 65 ms
11,008 KB
testcase_14 WA -
testcase_15 AC 236 ms
10,880 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 95 ms
10,880 KB
testcase_21 WA -
testcase_22 AC 29 ms
10,880 KB
testcase_23 AC 29 ms
11,008 KB
testcase_24 AC 27 ms
10,880 KB
testcase_25 AC 27 ms
10,880 KB
testcase_26 AC 27 ms
10,880 KB
testcase_27 AC 27 ms
10,880 KB
testcase_28 AC 28 ms
10,752 KB
testcase_29 AC 137 ms
10,880 KB
testcase_30 AC 66 ms
11,008 KB
testcase_31 AC 30 ms
10,880 KB
testcase_32 AC 29 ms
10,880 KB
testcase_33 AC 196 ms
10,880 KB
testcase_34 AC 87 ms
10,880 KB
testcase_35 AC 33 ms
11,008 KB
testcase_36 AC 166 ms
11,008 KB
testcase_37 AC 439 ms
10,880 KB
testcase_38 AC 345 ms
10,880 KB
testcase_39 AC 264 ms
10,880 KB
testcase_40 AC 241 ms
10,880 KB
testcase_41 AC 239 ms
11,008 KB
testcase_42 AC 237 ms
10,880 KB
testcase_43 AC 28 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
C,D=list(map(int,input().split())),list(map(int,input().split()))
A=[0 for _ in range(1001)]
B=[1 for _ in range(1001)]
for i in range(N):
    if A[C[i]]<D[i]:
        A[C[i]]=D[i]
        B[C[i]]=1
    elif A[C[i]]==D[i]:
        B[C[i]]+=1
dp=[0 for _ in range(1001)]
pat=[0 for _ in range(1001)]
pat[0]=1
for i in range(1,K+1):
    for j in range(1,i+1):
        if dp[i] < dp[i-j]+A[j]:
            pat[i]=pat[i-j]*B[j]
            pat[i]%=998244353
            dp[i]= dp[i-j]+A[j]
        elif dp[i] == dp[i-j]+A[j]:
            pat[i]+=pat[i-j]*B[j]
            pat[i]%=998244353
print(dp[K])
print(pat[K])
0