結果
| 問題 |
No.2395 区間二次変換一点取得
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-28 22:05:44 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 912 bytes |
| コンパイル時間 | 5,883 ms |
| コンパイル使用メモリ | 316,588 KB |
| 実行使用メモリ | 30,492 KB |
| 最終ジャッジ日時 | 2024-10-06 18:57:56 |
| 合計ジャッジ時間 | 10,796 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 WA * 5 TLE * 1 -- * 6 |
ソースコード
#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';
}
}