結果
| 問題 |
No.2395 区間二次変換一点取得
|
| コンテスト | |
| ユーザー |
hitonanode
|
| 提出日時 | 2023-08-05 11:38:31 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 57 ms / 2,000 ms |
| コード長 | 762 bytes |
| コンパイル時間 | 1,044 ms |
| コンパイル使用メモリ | 94,680 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-15 08:43:41 |
| 合計ジャッジ時間 | 4,171 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
#include <atcoder/fenwicktree>
#include <atcoder/modint>
using mint = atcoder::modint;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int N, B, Q;
cin >> N >> B >> Q;
mint::set_mod(B);
vector<mint> Y(Q + 1, 1);
auto Z = Y;
for (int q = 1; q <= Q; ++q) {
Y.at(q) = Y.at(q - 1) * 3 + Z.at(q - 1) * ((q + 1) * 2);
Z.at(q) = Z.at(q - 1) * 3;
}
atcoder::fenwick_tree<int> bit(N + 1);
while (Q--) {
int l, m, r;
cin >> l >> m >> r;
--l;
bit.add(l, 1);
bit.add(r, -1);
int s = bit.sum(0, m);
cout << mint(s + 1).val() << ' ' << Y.at(s).val() << ' ' << Z.at(s).val() << '\n';
}
}
hitonanode