結果

問題 No.3424 Shooting Game
コンテスト
ユーザー 沙耶花
提出日時 2026-01-11 15:43:56
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
結果
AC  
実行時間 317 ms / 2,000 ms
コード長 871 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,528 ms
コンパイル使用メモリ 292,332 KB
実行使用メモリ 24,176 KB
最終ジャッジ日時 2026-01-11 17:24:05
合計ジャッジ時間 7,766 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001LL
long long op(long long a,long long b){
	return max(a,b);
}
long long e(){
	return 0;
}

int main(){
	
	int N,T;
	cin>>N>>T;
	
	vector<vector<int>> a(N);
	rep(i,N){
		int x,y,z;
		cin>>x>>y>>z;
		a[i] = {z,x,y};
	}
	set<int> S;
	rep(i,200005)S.insert(i);
	vector<int> ma(200005);
	sort(a.rbegin(),a.rend());
	rep(i,N){
		auto it = S.lower_bound(a[i][1]);
		while(it!=S.end() && *it<=a[i][2]){
			ma[(*it)] = a[i][0];
			it = S.erase(it);
		}
	}
	segtree<long long,op,e> seg(200005);
	rep(i,200005){
		long long v = ma[i];
		if(i-T>=0)v += seg.prod(0,i-T+1);
		seg.set(i,v);
		
	}
	cout<<seg.all_prod()<<endl;
	return 0;
}
0