結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
29,688 KB
testcase_01 AC 141 ms
29,752 KB
testcase_02 AC 146 ms
30,472 KB
testcase_03 AC 143 ms
30,468 KB
testcase_04 AC 144 ms
30,852 KB
testcase_05 AC 142 ms
30,432 KB
testcase_06 AC 146 ms
30,440 KB
testcase_07 AC 145 ms
30,432 KB
testcase_08 AC 146 ms
30,844 KB
testcase_09 AC 142 ms
30,416 KB
testcase_10 AC 145 ms
30,456 KB
testcase_11 AC 146 ms
30,512 KB
testcase_12 AC 148 ms
30,712 KB
testcase_13 AC 147 ms
30,472 KB
testcase_14 AC 142 ms
30,636 KB
testcase_15 AC 148 ms
30,444 KB
testcase_16 AC 147 ms
30,808 KB
testcase_17 AC 146 ms
30,340 KB
testcase_18 AC 149 ms
30,500 KB
testcase_19 AC 151 ms
30,688 KB
testcase_20 AC 146 ms
30,496 KB
testcase_21 AC 150 ms
30,592 KB
testcase_22 AC 192 ms
31,504 KB
testcase_23 AC 142 ms
29,712 KB
testcase_24 AC 185 ms
31,340 KB
testcase_25 AC 141 ms
29,680 KB
testcase_26 AC 140 ms
29,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
n = int(input())
A, B = zip(*(map(int, input().split()) for _ in range(n))) 
m = sum(A)
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