結果
問題 | No.54 Happy Hallowe'en |
ユーザー | brthyyjp |
提出日時 | 2021-11-04 00:51:02 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 533 bytes |
コンパイル時間 | 146 ms |
コンパイル使用メモリ | 82,260 KB |
実行使用メモリ | 315,648 KB |
最終ジャッジ日時 | 2024-04-21 18:16:10 |
合計ジャッジ時間 | 27,968 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
315,648 KB |
testcase_01 | AC | 41 ms
52,096 KB |
testcase_02 | AC | 37 ms
51,456 KB |
testcase_03 | AC | 36 ms
51,968 KB |
testcase_04 | AC | 837 ms
104,576 KB |
testcase_05 | AC | 1,457 ms
133,120 KB |
testcase_06 | AC | 2,297 ms
169,112 KB |
testcase_07 | AC | 3,459 ms
228,480 KB |
testcase_08 | AC | 4,447 ms
264,064 KB |
testcase_09 | TLE | - |
testcase_10 | AC | 38 ms
52,096 KB |
testcase_11 | AC | 37 ms
51,840 KB |
testcase_12 | AC | 2,528 ms
181,632 KB |
testcase_13 | TLE | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
ソースコード
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) m = -1 for k in dp: if k < t: if k+v >= t: nx.add(k+v) else: m = max(m, k+v) if m != -1: nx.add(m) dp = nx dp = list(dp) print(max(dp))