結果

問題 No.448 ゆきこーだーの雨と雪 (3)
ユーザー t98slidert98slider
提出日時 2023-03-26 16:51:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,167 bytes
コンパイル時間 4,503 ms
コンパイル使用メモリ 235,152 KB
実行使用メモリ 20,160 KB
最終ジャッジ日時 2023-10-19 13:44:16
合計ジャッジ時間 12,548 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 3 ms
4,348 KB
testcase_12 WA -
testcase_13 AC 30 ms
5,376 KB
testcase_14 AC 34 ms
5,640 KB
testcase_15 AC 93 ms
11,380 KB
testcase_16 WA -
testcase_17 AC 170 ms
18,836 KB
testcase_18 AC 25 ms
5,376 KB
testcase_19 WA -
testcase_20 AC 74 ms
8,016 KB
testcase_21 AC 216 ms
19,888 KB
testcase_22 AC 79 ms
11,116 KB
testcase_23 AC 220 ms
19,888 KB
testcase_24 WA -
testcase_25 AC 216 ms
19,888 KB
testcase_26 WA -
testcase_27 AC 163 ms
18,832 KB
testcase_28 WA -
testcase_29 AC 84 ms
11,116 KB
testcase_30 WA -
testcase_31 AC 30 ms
5,376 KB
testcase_32 AC 33 ms
5,640 KB
testcase_33 WA -
testcase_34 AC 234 ms
20,152 KB
testcase_35 WA -
testcase_36 AC 235 ms
20,152 KB
testcase_37 WA -
testcase_38 AC 235 ms
20,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;

using S = pair<int, ll>;
using F = pair<int, ll>;
//単位元
S e(){return make_pair(1 << 30, 1 << 30);}
//演算
S op(S l,S r){return min(l, r);}
//xにfを作用させた時の値の変化
S mapping(F f,S x){return make_pair(max(x.first, f.first), x.second + f.second);}
//gを演算した後にfを演算させると演算子はどうなるか
F composition(F f, F g){return make_pair(max(f.first, g.first), f.second + g.second);}
//作用させても変化させないもの
F id(){return make_pair(0, 0);}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    vector<int> T(N + 1), D(N + 1);
    for(int i = 1; i <= N; i++) cin >> T[i] >> D[i];
    T[0] = -(1 << 30);
    atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(N + 1);
    seg.set(0, {0, 0});
    for(int i = 1, r = 0; i <= N; i++){
        while(T[r] + K <= T[i]) r++;
        seg.set(i, seg.prod(0, r));
        seg.apply(0, i, make_pair(D[i], D[i]));
    }
    auto p = seg.all_prod();
    cout << p.first << '\n';
    cout << p.second << '\n';
}
0