結果
問題 |
No.2808 Concentration
|
ユーザー |
|
提出日時 | 2024-07-12 22:38:50 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 934 bytes |
コンパイル時間 | 2,433 ms |
コンパイル使用メモリ | 199,812 KB |
最終ジャッジ日時 | 2025-02-22 04:41:25 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 52 |
ソースコード
#include<bits/stdc++.h> #include<atcoder/segtree> using namespace std; using ll=long long; #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;} template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;} const ll INF=1LL<<60; ll op(ll l,ll r){return max(l,r);} ll e(){return -INF;} int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N,S,H; cin>>N>>S>>H; vector<int>X(N),Y(N); vector<ll>Z(N); atcoder::segtree<ll,op,e>seg(N+1); seg.set(0,0); for(int i=0;i<N;i++)cin>>X[i]>>Y[i]>>Z[i]; for(int i=0;i<N;i++){ if(Y[i]-X[i]<=S){ auto id=lower_bound(all(Y),X[i]-H+1); seg.set(i+1,seg.prod(0,id-Y.begin()+1)+Z[i]); } } ll ans=0; for(int i=0;i<=N;i++)chmax(ans,seg.get(i)); cout<<ans<<"\n"; }