結果

問題 No.3424 Shooting Game
コンテスト
ユーザー NaH54i
提出日時 2026-01-11 16:30:26
言語 PyPy3
(7.3.17)
結果
RE  
実行時間 -
コード長 799 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 380 ms
コンパイル使用メモリ 82,508 KB
実行使用メモリ 97,964 KB
最終ジャッジ日時 2026-01-11 16:30:30
合計ジャッジ時間 4,360 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other WA * 3 RE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, T = map(int, input().split())
LEN = 2 * 10**5 + 2
c = [[] for _ in range(LEN)]
for _ in range(N):
    _l, _r, _p = map(int, input().split())
    c[_l].append(_p)
    c[_r + 1].append(-_p)
c[0] = max(c[0])
for i in range(1, LEN):
    if c[i] == []:
        c[i] = c[i - 1]
    elif max(c[i]) > 0:
        c[i] = max(max(c[i]), c[i - 1])
    elif -c[i - 1] not in c[i]:
        c[i] = c[i - 1]
    else:
        c[i] = 0
p = [0] * LEN
i = 0
ans = 0
while i < LEN:
    if c[i] != 0:
        p[i + T] = c[i]
        i += 1
        break
    i += 1
while i < LEN:
    if p[i - 1] > p[i]:
        p[i] = p[i - 1]
    if c[i] > 0:
        if i + T >= LEN:
            ans = max(ans, c[i] + p[i])
        elif c[i] + p[i] > p[i + T]:
            p[i + T] = c[i] + p[i]
    i += 1

print(max(p[-1], ans))
0