結果

問題 No.2808 Concentration
ユーザー highlighterhighlighter
提出日時 2024-07-08 17:49:09
言語 C++23
(gcc 12.3.0 + boost 1.83.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
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 350 ms
19,796 KB
testcase_01 AC 356 ms
19,752 KB
testcase_02 AC 352 ms
19,796 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 145 ms
11,064 KB
testcase_07 AC 58 ms
6,944 KB
testcase_08 AC 4 ms
6,940 KB
testcase_09 AC 216 ms
12,480 KB
testcase_10 AC 209 ms
12,288 KB
testcase_11 AC 93 ms
7,488 KB
testcase_12 AC 318 ms
19,260 KB
testcase_13 AC 48 ms
6,944 KB
testcase_14 AC 301 ms
19,092 KB
testcase_15 AC 300 ms
18,824 KB
testcase_16 AC 334 ms
19,444 KB
testcase_17 AC 338 ms
19,788 KB
testcase_18 AC 166 ms
11,284 KB
testcase_19 AC 313 ms
19,372 KB
testcase_20 AC 285 ms
18,752 KB
testcase_21 AC 211 ms
12,076 KB
testcase_22 AC 189 ms
11,932 KB
testcase_23 AC 313 ms
19,008 KB
testcase_24 AC 166 ms
11,432 KB
testcase_25 AC 317 ms
19,140 KB
testcase_26 AC 347 ms
19,780 KB
testcase_27 AC 343 ms
19,688 KB
testcase_28 AC 336 ms
19,684 KB
testcase_29 AC 334 ms
19,848 KB
testcase_30 AC 335 ms
19,648 KB
testcase_31 AC 340 ms
19,784 KB
testcase_32 AC 350 ms
19,844 KB
testcase_33 AC 338 ms
19,728 KB
testcase_34 AC 338 ms
19,748 KB
testcase_35 AC 352 ms
19,712 KB
testcase_36 AC 347 ms
19,784 KB
testcase_37 AC 344 ms
19,672 KB
testcase_38 AC 348 ms
19,824 KB
testcase_39 AC 350 ms
19,708 KB
testcase_40 AC 340 ms
19,748 KB
testcase_41 AC 353 ms
19,860 KB
testcase_42 AC 360 ms
19,852 KB
testcase_43 AC 342 ms
19,784 KB
testcase_44 AC 335 ms
19,724 KB
testcase_45 AC 341 ms
19,688 KB
testcase_46 AC 2 ms
6,940 KB
testcase_47 AC 2 ms
6,944 KB
testcase_48 AC 1 ms
6,940 KB
testcase_49 AC 2 ms
6,944 KB
testcase_50 AC 1 ms
6,940 KB
testcase_51 AC 2 ms
6,944 KB
testcase_52 AC 1 ms
6,940 KB
testcase_53 AC 2 ms
6,940 KB
testcase_54 AC 1 ms
6,940 KB
testcase_55 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0