結果

問題 No.710 チーム戦
ユーザー qibqib
提出日時 2022-12-27 00:00:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 626 ms / 3,000 ms
コード長 317 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 82,780 KB
実行使用メモリ 211,740 KB
最終ジャッジ日時 2024-05-01 08:04:34
合計ジャッジ時間 11,564 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
51,712 KB
testcase_01 AC 44 ms
51,840 KB
testcase_02 AC 477 ms
151,928 KB
testcase_03 AC 455 ms
153,780 KB
testcase_04 AC 505 ms
165,564 KB
testcase_05 AC 431 ms
145,624 KB
testcase_06 AC 451 ms
151,992 KB
testcase_07 AC 483 ms
159,204 KB
testcase_08 AC 484 ms
157,084 KB
testcase_09 AC 475 ms
158,708 KB
testcase_10 AC 402 ms
142,512 KB
testcase_11 AC 442 ms
154,368 KB
testcase_12 AC 502 ms
164,900 KB
testcase_13 AC 459 ms
158,648 KB
testcase_14 AC 482 ms
156,920 KB
testcase_15 AC 433 ms
139,880 KB
testcase_16 AC 476 ms
164,180 KB
testcase_17 AC 397 ms
144,844 KB
testcase_18 AC 453 ms
153,860 KB
testcase_19 AC 492 ms
161,444 KB
testcase_20 AC 448 ms
152,436 KB
testcase_21 AC 472 ms
159,504 KB
testcase_22 AC 50 ms
59,788 KB
testcase_23 AC 50 ms
59,648 KB
testcase_24 AC 626 ms
211,740 KB
testcase_25 AC 40 ms
51,888 KB
testcase_26 AC 41 ms
51,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

dp = {}
dp[0] = 0
s = 0
for _ in range(n):
  a, b = map(int, input().split())
  s += b
  ndp = {}
  for k, v in dp.items():
    ndp[k] = max(ndp.get(k, 0), v)
    ndp[k + a] = max(ndp.get(k + a, 0), v + b)
  dp = ndp

ans = 1 << 60
for k, v in dp.items():
  ans = min(ans, max(k, s - v))

print(ans)
0