結果

問題 No.1163 I want to be a high achiever
ユーザー mlihua09mlihua09
提出日時 2020-08-26 02:30:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 448 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 65,280 KB
最終ジャッジ日時 2024-04-24 05:02:06
合計ジャッジ時間 3,695 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 36 ms
52,224 KB
testcase_02 AC 46 ms
60,800 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 36 ms
52,352 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 38 ms
52,864 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 38 ms
52,480 KB
testcase_27 AC 36 ms
52,480 KB
testcase_28 AC 38 ms
52,224 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 35 ms
51,968 KB
testcase_32 AC 37 ms
51,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


N, X = map(int, input().split())

A = list(map(lambda x: X - int(x), input().split()))

B = list(map(int, input().split()))

n = sum(A)

if n <= 0:
    
    print(0)
    
    exit()
    
dp = [0] + [sum(B)] * n


for i in range(N):
    
    if A[i] > 0:
        
        for j in range(-1, -n - 2, -1):
            
            dp[j] = min(dp[j], dp[max(j - A[i], -n-1)] + B[i])
            
            


if dp[-1] == sum(B):
    
    print(-1)
0