結果

問題 No.710 チーム戦
ユーザー dpforestdpforest
提出日時 2018-06-30 00:25:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 305 ms / 3,000 ms
コード長 400 bytes
コンパイル時間 1,064 ms
コンパイル使用メモリ 86,640 KB
実行使用メモリ 156,472 KB
最終ジャッジ日時 2023-09-13 15:56:50
合計ジャッジ時間 8,438 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
79,964 KB
testcase_01 AC 91 ms
81,604 KB
testcase_02 AC 296 ms
156,092 KB
testcase_03 AC 292 ms
156,156 KB
testcase_04 AC 299 ms
156,252 KB
testcase_05 AC 292 ms
156,348 KB
testcase_06 AC 290 ms
156,324 KB
testcase_07 AC 291 ms
156,216 KB
testcase_08 AC 295 ms
156,284 KB
testcase_09 AC 294 ms
156,268 KB
testcase_10 AC 290 ms
156,200 KB
testcase_11 AC 291 ms
156,176 KB
testcase_12 AC 292 ms
156,296 KB
testcase_13 AC 290 ms
156,092 KB
testcase_14 AC 290 ms
156,144 KB
testcase_15 AC 288 ms
156,264 KB
testcase_16 AC 290 ms
156,252 KB
testcase_17 AC 284 ms
156,312 KB
testcase_18 AC 294 ms
156,472 KB
testcase_19 AC 293 ms
156,216 KB
testcase_20 AC 296 ms
156,440 KB
testcase_21 AC 282 ms
156,104 KB
testcase_22 AC 228 ms
156,084 KB
testcase_23 AC 219 ms
156,156 KB
testcase_24 AC 305 ms
156,272 KB
testcase_25 AC 80 ms
78,556 KB
testcase_26 AC 81 ms
78,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

maxt = 10**5
dp = [float('inf')] * (maxt+1)
dp[0] = 0
for i in range(n):
  ai, bi = p[i]
  dp2 = dp[:]
  for i in range(maxt-1000+1):
    dp2[i] = dp[i] + bi
  for i in range(maxt-1000+1):
    dp2[i+ai] = min(dp2[i+ai], dp[i])
  dp = dp2

ans = float('inf')
for i in range(maxt+1):
  ans = min(ans, max(i,dp[i]))

print(ans)
0