結果

問題 No.710 チーム戦
ユーザー H3PO4H3PO4
提出日時 2021-01-20 10:03:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 239 ms / 3,000 ms
コード長 366 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 10,612 KB
実行使用メモリ 32,756 KB
最終ジャッジ日時 2023-08-23 13:19:17
合計ジャッジ時間 9,751 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
32,592 KB
testcase_01 AC 142 ms
32,476 KB
testcase_02 AC 235 ms
32,508 KB
testcase_03 AC 234 ms
32,652 KB
testcase_04 AC 230 ms
32,556 KB
testcase_05 AC 232 ms
32,492 KB
testcase_06 AC 233 ms
32,596 KB
testcase_07 AC 235 ms
32,504 KB
testcase_08 AC 232 ms
32,612 KB
testcase_09 AC 232 ms
32,512 KB
testcase_10 AC 229 ms
32,756 KB
testcase_11 AC 232 ms
32,612 KB
testcase_12 AC 232 ms
32,400 KB
testcase_13 AC 232 ms
32,500 KB
testcase_14 AC 234 ms
32,588 KB
testcase_15 AC 233 ms
32,516 KB
testcase_16 AC 231 ms
32,624 KB
testcase_17 AC 233 ms
32,524 KB
testcase_18 AC 232 ms
32,464 KB
testcase_19 AC 235 ms
32,592 KB
testcase_20 AC 233 ms
32,636 KB
testcase_21 AC 234 ms
32,488 KB
testcase_22 AC 231 ms
32,676 KB
testcase_23 AC 239 ms
32,636 KB
testcase_24 AC 237 ms
32,592 KB
testcase_25 AC 139 ms
32,384 KB
testcase_26 AC 139 ms
32,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N = int(input())
AB = []
sumB = 0
for _ in range(N):
    a, b = map(int, input().split())
    sumB += b
    AB.append((a, b))

MAX = 10 ** 5 + 1

dp = np.zeros(MAX, dtype=int)
for a, b in AB:
    new_dp = dp.copy()
    new_dp[a:] = np.maximum(dp[a:], dp[:MAX - a] + b)
    dp = new_dp

ans = np.maximum(np.arange(MAX), sumB - dp).min()
print(ans)
0