結果
問題 |
No.2395 区間二次変換一点取得
|
ユーザー |
|
提出日時 | 2023-07-27 08:19:37 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 250 ms / 2,000 ms |
コード長 | 438 bytes |
コンパイル時間 | 3,630 ms |
コンパイル使用メモリ | 181,228 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-04 00:13:46 |
合計ジャッジ時間 | 7,146 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <iostream> #include <atcoder/all> using namespace std; using mint = atcoder::modint; int main() { int n, b, q, l, m, r; cin >> n >> b >> q; mint::set_mod(b); atcoder::fenwick_tree<mint> f(n + 1); while (cin >> l >> m >> r) { f.add(l - 1, 1); f.add(r, -1); mint x = f.sum(0, m); cout << (x + 1).val() << ' ' << (mint(3).pow(x.val() - 1) * (x * x + 3 * x + 3)).val() << ' ' << mint(3).pow(x.val()).val() << '\n'; } }