結果
| 問題 |
No.844 split game
|
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2025-06-09 20:33:11 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 617 bytes |
| コンパイル時間 | 557 ms |
| コンパイル使用メモリ | 82,312 KB |
| 実行使用メモリ | 67,768 KB |
| 最終ジャッジ日時 | 2025-06-09 20:33:20 |
| 合計ジャッジ時間 | 7,308 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 4 |
| other | RE * 56 |
ソースコード
from atcoder.segtree import SegTree
N,M,A = map(int,input().split())
ST = SegTree(max, 0, [0] * (N+1))
LRP = [list(map(int,input().split())) for _ in range(M)]
LRP.sort(key = lambda x:x[1])
ans = 0
for l,r,p in LRP:
if l == 1:
x = p - A
if r == N:
x += A
if x > ST.get(r):
ST.set(r,x)
ans = max(ans,x)
else:
x = ST.prod(0,l-2)
y = ST.get(l-1) + A
if y > 1:
x = max(x,y)
x += p - 2 * A
if r == N:
x += A
if x > ST.get(r):
ST.set(r,x)
ans = max(ans,x)
print(ans)
ntuda