結果

問題 No.54 Happy Hallowe'en
ユーザー brthyyjpbrthyyjp
提出日時 2021-11-04 00:47:42
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 409 bytes
コンパイル時間 647 ms
コンパイル使用メモリ 87,252 KB
実行使用メモリ 269,304 KB
最終ジャッジ日時 2023-08-03 19:54:00
合計ジャッジ時間 21,402 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,584 KB
testcase_01 AC 74 ms
71,460 KB
testcase_02 AC 75 ms
71,228 KB
testcase_03 AC 76 ms
71,088 KB
testcase_04 AC 907 ms
109,164 KB
testcase_05 AC 1,503 ms
137,800 KB
testcase_06 AC 2,353 ms
176,820 KB
testcase_07 AC 3,559 ms
240,180 KB
testcase_08 AC 4,914 ms
263,988 KB
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