結果

問題 No.710 チーム戦
ユーザー kohei2019kohei2019
提出日時 2022-03-21 14:06:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 364 ms / 3,000 ms
コード長 430 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 228,224 KB
最終ジャッジ日時 2024-04-17 07:09:25
合計ジャッジ時間 9,548 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
66,816 KB
testcase_01 AC 73 ms
71,424 KB
testcase_02 AC 359 ms
226,560 KB
testcase_03 AC 344 ms
226,944 KB
testcase_04 AC 341 ms
225,664 KB
testcase_05 AC 345 ms
226,688 KB
testcase_06 AC 352 ms
226,816 KB
testcase_07 AC 346 ms
226,176 KB
testcase_08 AC 358 ms
226,432 KB
testcase_09 AC 345 ms
227,328 KB
testcase_10 AC 341 ms
226,816 KB
testcase_11 AC 347 ms
226,432 KB
testcase_12 AC 349 ms
226,944 KB
testcase_13 AC 344 ms
226,816 KB
testcase_14 AC 348 ms
226,688 KB
testcase_15 AC 353 ms
226,304 KB
testcase_16 AC 364 ms
227,200 KB
testcase_17 AC 335 ms
225,920 KB
testcase_18 AC 351 ms
228,224 KB
testcase_19 AC 349 ms
227,072 KB
testcase_20 AC 357 ms
226,816 KB
testcase_21 AC 346 ms
227,072 KB
testcase_22 AC 298 ms
222,080 KB
testcase_23 AC 272 ms
221,568 KB
testcase_24 AC 330 ms
226,048 KB
testcase_25 AC 56 ms
62,336 KB
testcase_26 AC 58 ms
63,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
lsAB = [tuple(map(int,input().split())) for i in range(N)]
inf = float('INF')
dp = [inf]*(10**5+1)
dp[0] = 0
for i in range(N):
    dp2 = [inf]*(10**5+1)
    A,B = lsAB[i]
    for j in range(10**5+1):
        if j+A <= 10**5:
            dp2[j+A] = dp[j]
    for j in range(10**5+1):
        dp2[j] = min(dp2[j],dp[j]+B)
    dp = dp2
ans = inf
for i in range(10**5+1):
    ans = min(ans,max(i, dp[i]))
print(ans)
0