結果

問題 No.54 Happy Hallowe'en
ユーザー brthyyjpbrthyyjp
提出日時 2021-11-04 00:47:42
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 409 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 82,260 KB
実行使用メモリ 270,900 KB
最終ジャッジ日時 2024-04-21 18:11:10
合計ジャッジ時間 21,717 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
52,644 KB
testcase_01 AC 44 ms
53,376 KB
testcase_02 AC 44 ms
53,412 KB
testcase_03 AC 44 ms
51,820 KB
testcase_04 AC 937 ms
108,076 KB
testcase_05 AC 1,538 ms
137,016 KB
testcase_06 AC 2,426 ms
175,824 KB
testcase_07 AC 3,964 ms
240,368 KB
testcase_08 TLE -
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

n = int(input())
VT = []
for i in range(n):
    v, t = map(int, input().split())
    VT.append((v,t))

VT.sort(key=lambda x: x[0]+x[1])
dp = set()
dp.add(0)
for v, t in VT:
    nx = set()
    for k in dp:
        nx.add(k)
    for k in dp:
        if k < t:
            nx.add(k+v)
    dp = nx
dp = list(dp)
print(max(dp))
0