結果

問題 No.54 Happy Hallowe'en
ユーザー brthyyjp
提出日時 2021-11-04 00:47:42
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 409 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 82,236 KB
実行使用メモリ 271,068 KB
最終ジャッジ日時 2024-10-13 17:07:08
合計ジャッジ時間 19,345 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

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