結果

問題 No.710 チーム戦
ユーザー togetogehattogetogehat
提出日時 2018-07-26 03:03:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 180 ms / 3,000 ms
コード長 278 bytes
コンパイル時間 469 ms
コンパイル使用メモリ 10,712 KB
実行使用メモリ 31,788 KB
最終ジャッジ日時 2023-09-10 04:28:57
合計ジャッジ時間 8,057 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
29,892 KB
testcase_01 AC 140 ms
29,896 KB
testcase_02 AC 137 ms
30,356 KB
testcase_03 AC 136 ms
29,960 KB
testcase_04 AC 138 ms
30,436 KB
testcase_05 AC 138 ms
30,204 KB
testcase_06 AC 137 ms
30,408 KB
testcase_07 AC 138 ms
30,352 KB
testcase_08 AC 134 ms
30,596 KB
testcase_09 AC 139 ms
30,436 KB
testcase_10 AC 140 ms
30,444 KB
testcase_11 AC 139 ms
30,484 KB
testcase_12 AC 139 ms
30,252 KB
testcase_13 AC 138 ms
30,368 KB
testcase_14 AC 141 ms
30,376 KB
testcase_15 AC 140 ms
30,432 KB
testcase_16 AC 141 ms
30,492 KB
testcase_17 AC 143 ms
30,356 KB
testcase_18 AC 141 ms
30,420 KB
testcase_19 AC 139 ms
30,396 KB
testcase_20 AC 139 ms
30,512 KB
testcase_21 AC 138 ms
30,264 KB
testcase_22 AC 180 ms
31,688 KB
testcase_23 AC 134 ms
29,936 KB
testcase_24 AC 174 ms
31,788 KB
testcase_25 AC 135 ms
29,836 KB
testcase_26 AC 136 ms
29,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
n = int(input())
A, B = zip(*(map(int, input().split()) for _ in range(n))) 
m = np.minimum(A, B).sum()
dp = np.zeros(m+1, dtype='int32')
for a, b in zip(A, B):
    dp += b
    dp[a:] = np.minimum(dp[a:], dp[:-a]-b)
print(np.maximum(np.arange(m+1), dp).min())
0