結果

問題 No.710 チーム戦
ユーザー togetogehattogetogehat
提出日時 2018-07-26 22:29:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 168 ms / 3,000 ms
コード長 310 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 10,780 KB
実行使用メモリ 31,732 KB
最終ジャッジ日時 2023-09-13 18:50:09
合計ジャッジ時間 4,777 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
30,012 KB
testcase_01 AC 124 ms
29,848 KB
testcase_02 AC 131 ms
30,444 KB
testcase_03 AC 127 ms
30,176 KB
testcase_04 AC 127 ms
30,180 KB
testcase_05 AC 127 ms
30,340 KB
testcase_06 AC 126 ms
30,388 KB
testcase_07 AC 126 ms
30,224 KB
testcase_08 AC 131 ms
30,440 KB
testcase_09 AC 128 ms
30,228 KB
testcase_10 AC 128 ms
30,360 KB
testcase_11 AC 126 ms
30,316 KB
testcase_12 AC 126 ms
30,464 KB
testcase_13 AC 126 ms
30,352 KB
testcase_14 AC 125 ms
30,240 KB
testcase_15 AC 131 ms
30,408 KB
testcase_16 AC 126 ms
30,340 KB
testcase_17 AC 127 ms
30,312 KB
testcase_18 AC 125 ms
30,320 KB
testcase_19 AC 126 ms
30,464 KB
testcase_20 AC 127 ms
30,380 KB
testcase_21 AC 126 ms
30,364 KB
testcase_22 AC 168 ms
31,732 KB
testcase_23 AC 124 ms
29,956 KB
testcase_24 AC 165 ms
31,604 KB
testcase_25 AC 126 ms
29,788 KB
testcase_26 AC 124 ms
29,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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