結果
| 問題 | No.3424 Shooting Game |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-11 15:04:55 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 296 ms / 2,000 ms |
| + 155µs | |
| コード長 | 743 bytes |
| 記録 | |
| コンパイル時間 | 2,220 ms |
| コンパイル使用メモリ | 344,188 KB |
| 実行使用メモリ | 40,688 KB |
| 最終ジャッジ日時 | 2026-07-20 08:17:03 |
| 合計ジャッジ時間 | 5,321 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/segtree>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
ll op(ll a,ll b){
return max(a,b);
}
ll e(){
return 0;
}
int main(){
int n,t;
cin >> n >> t;
const int m=4e5+1;
vector<vector<int>>l(m),r(m);
rep(i,n){
int L,R,p;
cin >> L >> R >> p;
l[L].push_back(p);
r[R].push_back(p);
}
multiset<ll>s;
atcoder::segtree<ll,op,e>seg(m);
rep(i,m){
for(int j:l[i])s.insert(j);
if(i!=0)for(int j:r[i-1])s.erase(s.find(j));
if(s.size()==0)continue;
seg.set(i,seg.prod(0,max(i-t+1,0))+*s.rbegin());
}
cout << seg.all_prod() << endl;
return 0;
}