結果

問題 No.710 チーム戦
コンテスト
ユーザー rin204
提出日時 2022-11-11 14:55:10
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 125 ms / 3,000 ms
コード長 395 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 120 ms
コンパイル使用メモリ 85,236 KB
実行使用メモリ 144,484 KB
最終ジャッジ日時 2026-04-04 04:43:48
合計ジャッジ時間 4,014 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())

inf = 1 << 60
ma = 10 ** 5
dp = [inf] * (ma + 1)
dp[0] = 0
for _ in range(n):
    a, b = map(int, input().split())
    ndp = [inf] * (ma + 1)
    for i in range(a, ma + 1):
        ndp[i] = min(ndp[i], dp[i - a])
    for i in range(ma + 1):
        ndp[i] = min(ndp[i], dp[i] + b)
    dp = ndp

ans = 1 << 60
for i in range(ma + 1):
    ans = min(ans, max(i, dp[i]))
print(ans)
0