結果
| 問題 |
No.2808 Concentration
|
| コンテスト | |
| ユーザー |
highlighter
|
| 提出日時 | 2024-07-08 17:49:09 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 360 ms / 2,000 ms |
| コード長 | 986 bytes |
| コンパイル時間 | 4,751 ms |
| コンパイル使用メモリ | 312,676 KB |
| 実行使用メモリ | 19,860 KB |
| 最終ジャッジ日時 | 2024-07-10 15:19:23 |
| 合計ジャッジ時間 | 20,784 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 56 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
long long op(long long a,long long b){
return max(a,b);
}
long long e(){
return 0LL;
}
long long mapping(long long f,long long x){
return f+x;
}
long long composition(long long f,long long g){
return f+g;
}
long long id(){
return 0;
}
int main(){
int N;
long long S,H;
cin >> N >> S >> H;
long long X[N];
long long Y[N];
long long Z[N];
for(int i=0;i<N;i++){
cin >> X[i] >> Y[i] >> Z[i];
}
lazy_segtree<long long,op,e,long long,mapping,composition,id> dpx(N);
segtree<long long,op,e> dpy(N);
dpx.set(0,Z[0]);
if(Y[0]-X[0]<=S){
dpy.set(0,Z[0]);
}
for(int i=1;i<N;i++){
int r=upper_bound(Y,Y+i,X[i]-H)-Y;
dpx.set(i,dpy.prod(0,r));
dpx.apply(0,i+1,Z[i]);
int l=lower_bound(X,X+i+1,Y[i]-S)-X;
dpy.set(i,dpx.prod(l,i+1));
}
cout << dpy.all_prod() << endl;
}
highlighter