結果

問題 No.710 チーム戦
ユーザー terasaterasa
提出日時 2022-06-02 17:00:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 327 ms / 3,000 ms
コード長 1,191 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 81,756 KB
実行使用メモリ 148,676 KB
最終ジャッジ日時 2023-10-21 01:12:52
合計ジャッジ時間 8,737 ms
ジャッジサーバーID
(参考情報)
judge12 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
67,192 KB
testcase_01 AC 63 ms
68,784 KB
testcase_02 AC 309 ms
148,656 KB
testcase_03 AC 304 ms
148,656 KB
testcase_04 AC 308 ms
148,656 KB
testcase_05 AC 301 ms
148,656 KB
testcase_06 AC 302 ms
148,656 KB
testcase_07 AC 306 ms
148,656 KB
testcase_08 AC 306 ms
148,656 KB
testcase_09 AC 306 ms
148,656 KB
testcase_10 AC 298 ms
148,656 KB
testcase_11 AC 296 ms
148,656 KB
testcase_12 AC 307 ms
148,656 KB
testcase_13 AC 305 ms
148,660 KB
testcase_14 AC 305 ms
148,656 KB
testcase_15 AC 302 ms
148,656 KB
testcase_16 AC 306 ms
148,656 KB
testcase_17 AC 300 ms
148,656 KB
testcase_18 AC 303 ms
148,656 KB
testcase_19 AC 308 ms
148,656 KB
testcase_20 AC 305 ms
148,660 KB
testcase_21 AC 305 ms
148,660 KB
testcase_22 AC 261 ms
146,568 KB
testcase_23 AC 262 ms
146,588 KB
testcase_24 AC 327 ms
148,676 KB
testcase_25 AC 50 ms
63,512 KB
testcase_26 AC 51 ms
63,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import pypyjit
import itertools
import heapq
import math
from collections import deque, defaultdict
import bisect

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
pypyjit.set_param('max_unroll_recursion=-1')


def index_lt(a, x):
    'return largest index s.t. A[i] < x or -1 if it does not exist'
    return bisect.bisect_left(a, x) - 1


def index_le(a, x):
    'return largest index s.t. A[i] <= x or -1 if it does not exist'
    return bisect.bisect_right(a, x) - 1


def index_gt(a, x):
    'return smallest index s.t. A[i] > x or len(a) if it does not exist'
    return bisect.bisect_right(a, x)


def index_ge(a, x):
    'return smallest index s.t. A[i] >= x or len(a) if it does not exist'
    return bisect.bisect_left(a, x)


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

INF = 1 << 30
L = 102000
dp = [[INF for _ in range(L + 10)] for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
    a, b = T[i]
    for j in range(100000 + 1):
        dp[i + 1][j + a] = min(dp[i + 1][j + a], dp[i][j])
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + b)

ans = INF
for j in range(L + 1):
    ans = min(ans, max(j, dp[N][j]))
print(ans)
0