結果

問題 No.2395 区間二次変換一点取得
ユーザー ShirotsumeShirotsume
提出日時 2023-07-28 22:05:44
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 912 bytes
コンパイル時間 7,314 ms
コンパイル使用メモリ 337,728 KB
実行使用メモリ 30,760 KB
最終ジャッジ日時 2024-04-16 06:01:53
合計ジャッジ時間 12,065 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using S = vector<int>;
using F = int;
int mod = 998244353;
S op(S a, S b){ return a;}
S e(){ return {1, 1, 1}; }
S mapping(F f, S x){
    for(int i = 0; i < f; i++){
      int a, b, c;
        a = x[0];b = x[1]; c = x[2];
        x = {(a + 1) % mod, (3 * b + 2 * (a + 1) * c) % mod, 3 * c % mod};
    }
  	return x;
}
F composition(F f, F g){ return f + g;}
F id(){ return 0; }

int main(){
    int N, Q;
    cin >> N >> mod >> Q;
    vector<S> v(N);
    for(int i = 0; i < N; i++){
        v[i] = {1, 1, 1};
    }
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(v);

    for(int i = 0; i < Q; i++){
        int l, m, r;
        cin >> l >> m >> r;
        l--;
        seg.apply(l, r, 1);
        vector<int> ans = seg.get(m - 1);
        cout << ans[0] << ' ' << ans[1] << ' ' << ans[2] << '\n';
    }
}
0