結果
問題 | No.974 最後の日までに |
ユーザー | tktk_snsn |
提出日時 | 2021-01-15 13:30:56 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,384 bytes |
コンパイル時間 | 382 ms |
コンパイル使用メモリ | 82,108 KB |
実行使用メモリ | 851,044 KB |
最終ジャッジ日時 | 2024-11-25 21:08:48 |
合計ジャッジ時間 | 12,888 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 MLE * 1 |
other | AC * 48 TLE * 1 |
ソースコード
W = int(input()) d = [(0, 0)] #points, money w = [(0, 0)] s = [] def merge(school, work, date, a, b, c): #date res_d = [(x + b, y - c) for x, y in school] res_s, res_w = [], [] work.reverse(); date.reverse() while work and date: if work[-1][0] < date[-1][0]: score, money = work.pop() else: score, money = date.pop() while res_s and res_s[-1][1] <= money: res_s.pop() res_w.pop() res_s.append((score, money)) res_w.append((score, money + a)) while work: score, money = work.pop() while res_s and res_s[-1][1] <= money: res_s.pop() res_w.pop() res_s.append((score, money)) res_w.append((score, money + a)) while date: score, money = date.pop() while res_s and res_s[-1][1] <= money: res_s.pop() res_w.pop() res_s.append((score, money)) res_w.append((score, money + a)) return res_s, res_w, res_d for _ in range(W): a, b, c = map(int, input().split()) s, w, d = merge(s, w, d, a, b, c) ans = 0 for score, money in s: if money >= 0: ans = max(ans, score) for score, money in w: if money >= 0: ans = max(ans, score) for score, money in d: if money >= 0: ans = max(ans, score) print(ans)