結果

問題 No.1163 I want to be a high achiever
ユーザー mkawa2mkawa2
提出日時 2021-06-22 14:44:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,127 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 76,468 KB
最終ジャッジ日時 2023-09-05 16:13:07
合計ジャッジ時間 5,413 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
75,608 KB
testcase_01 AC 77 ms
71,012 KB
testcase_02 AC 85 ms
75,368 KB
testcase_03 AC 83 ms
75,824 KB
testcase_04 AC 124 ms
75,864 KB
testcase_05 AC 151 ms
76,200 KB
testcase_06 AC 102 ms
76,216 KB
testcase_07 AC 166 ms
76,256 KB
testcase_08 AC 164 ms
76,028 KB
testcase_09 AC 79 ms
71,016 KB
testcase_10 AC 128 ms
75,964 KB
testcase_11 AC 149 ms
76,320 KB
testcase_12 AC 128 ms
76,056 KB
testcase_13 AC 105 ms
75,676 KB
testcase_14 AC 106 ms
76,012 KB
testcase_15 AC 158 ms
76,172 KB
testcase_16 AC 119 ms
76,076 KB
testcase_17 AC 133 ms
75,944 KB
testcase_18 AC 163 ms
76,160 KB
testcase_19 AC 106 ms
76,052 KB
testcase_20 AC 96 ms
76,048 KB
testcase_21 AC 77 ms
70,832 KB
testcase_22 AC 145 ms
76,468 KB
testcase_23 AC 137 ms
75,732 KB
testcase_24 AC 168 ms
76,416 KB
testcase_25 AC 121 ms
76,048 KB
testcase_26 AC 77 ms
71,040 KB
testcase_27 AC 76 ms
70,784 KB
testcase_28 AC 77 ms
71,176 KB
testcase_29 WA -
testcase_30 AC 75 ms
70,880 KB
testcase_31 AC 76 ms
71,124 KB
testcase_32 AC 75 ms
71,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**16
# md = 998244353
md = 10**9+7

n, x = LI()
aa = LI()
bb = LI()
aa = [-a+x for a in aa]
s = sum(aa)
if s <= 0:
    print(0)
    exit()

dp = [inf]*(s+1)
dp[0] = 0
for a, b in zip(aa, bb):
    if a <= 0: continue
    for i in range(s, -1, -1):
        pre = dp[i]
        if pre == inf: continue
        ni = min(i+a, s)
        dp[ni] = min(dp[ni], pre+b)

lim = sum(b for a, b in zip(aa, bb) if a > 0)
ans = dp[-1]
if ans >= lim: ans = -1

print(ans)
0