結果

問題 No.2395 区間二次変換一点取得
ユーザー 👑 獅子座じゃない人獅子座じゃない人
提出日時 2023-07-28 22:47:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,374 bytes
コンパイル時間 2,008 ms
コンパイル使用メモリ 183,284 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-04-16 06:45:07
合計ジャッジ時間 11,206 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#include "atcoder/modint"
#include "atcoder/lazysegtree"
using namespace atcoder;
using mint=modint;

using S=tuple<mint,mint,mint>;
using F=tuple<long long,long long,long long,long long,long long>;
S op(S a, S b){
    return make_tuple(get<0>(a)+get<0>(b),get<1>(a)+get<1>(b),get<2>(a)+get<2>(b));
}
S e(){
    return make_tuple(0,0,0);
}
S mapping(F f, S x){
    return make_tuple(
        get<0>(x)+get<0>(f),
        get<1>(f)*get<1>(x)+get<2>(f)*get<0>(x)*get<2>(x)+get<3>(f)*get<2>(x),
        get<4>(f)*get<2>(x)
    );
}
F composition(F f, F g){
    return make_tuple(
        get<0>(f)+get<0>(g),
        get<1>(f)*get<1>(g),
        get<1>(f)*get<2>(g)+get<2>(f)*get<4>(g),
        get<1>(f)*get<3>(g)+get<2>(f)*get<0>(g)*get<4>(g)+get<3>(f)*get<4>(g),
        get<4>(f)*get<4>(g)
    );
}
F id(){
    return make_tuple(
        0,1,0,0,1
    );
}

int main(void) {
    int n,b,q;
    cin >> n >> b >> q;
    mint::set_mod(b);
    vector<S> v(n,make_tuple(1,1,1));
    lazy_segtree<S,op,e,F,mapping,composition,id> s(v);
    while(q--){
        int l,m,r;
        cin >> l >> m >> r;
        --l;
        --m;
        --r;
        s.apply(l,r+1,make_tuple(1,3,2,2,3));
        auto ans=s.get(m);
        cout << get<0>(ans).val() << " " << get<1>(ans).val() << " " << get<2>(ans).val() << endl;
    }
    return 0;
}
0