結果
| 問題 |
No.2395 区間二次変換一点取得
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-28 22:47:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,374 bytes |
| コンパイル時間 | 2,083 ms |
| コンパイル使用メモリ | 189,216 KB |
| 実行使用メモリ | 12,672 KB |
| 最終ジャッジ日時 | 2024-10-06 20:25:55 |
| 合計ジャッジ時間 | 10,844 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 WA * 10 |
ソースコード
#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;
}