結果
| 問題 | No.2395 区間二次変換一点取得 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-28 22:00:55 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 936 bytes |
| 記録 | |
| コンパイル時間 | 4,529 ms |
| コンパイル使用メモリ | 259,596 KB |
| 最終ジャッジ日時 | 2025-02-15 20:23:06 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 TLE * 2 -- * 6 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using S = vector<long long>;
using F = long long;
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++){
long long 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<long long> ans = seg.get(m - 1);
cout << ans[0] << ' ' << ans[1] << ' ' << ans[2] << '\n';
}
}