結果

問題 No.710 チーム戦
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-08-01 19:47:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 148 ms / 3,000 ms
コード長 492 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 82,456 KB
実行使用メモリ 74,240 KB
最終ジャッジ日時 2024-04-19 18:47:56
合計ジャッジ時間 4,531 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
55,680 KB
testcase_01 AC 57 ms
64,000 KB
testcase_02 AC 142 ms
73,472 KB
testcase_03 AC 138 ms
73,856 KB
testcase_04 AC 148 ms
72,576 KB
testcase_05 AC 139 ms
73,088 KB
testcase_06 AC 139 ms
71,680 KB
testcase_07 AC 141 ms
72,960 KB
testcase_08 AC 136 ms
73,088 KB
testcase_09 AC 139 ms
73,856 KB
testcase_10 AC 142 ms
73,728 KB
testcase_11 AC 145 ms
74,112 KB
testcase_12 AC 144 ms
73,728 KB
testcase_13 AC 141 ms
73,728 KB
testcase_14 AC 145 ms
73,600 KB
testcase_15 AC 145 ms
74,240 KB
testcase_16 AC 146 ms
73,856 KB
testcase_17 AC 138 ms
72,960 KB
testcase_18 AC 142 ms
73,088 KB
testcase_19 AC 142 ms
73,728 KB
testcase_20 AC 144 ms
73,600 KB
testcase_21 AC 144 ms
73,856 KB
testcase_22 AC 103 ms
67,200 KB
testcase_23 AC 50 ms
63,228 KB
testcase_24 AC 135 ms
73,856 KB
testcase_25 AC 44 ms
55,680 KB
testcase_26 AC 43 ms
56,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

N = int(input())
AB = [tuple(map(int,input().split())) for _ in range(N)]

ide_ele = -float('inf')

M = N*max(a for a,b in AB)
Sb = sum(b for a,b in AB)
val = [ide_ele]*(M+1)
val[0] = 0
for a,b in AB:
    
    for j in range(M,a-1,-1):
        
        val[j] = max(val[j],val[j-a]+b)
        
ans = min(max(a,Sb - val[a]) for a in range(M+1))
print(ans)
0