結果
問題 | No.2395 区間二次変換一点取得 |
ユーザー |
|
提出日時 | 2023-07-26 11:49:58 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,905 ms / 2,000 ms |
コード長 | 630 bytes |
コンパイル時間 | 313 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 12,032 KB |
最終ジャッジ日時 | 2024-10-02 22:43:27 |
合計ジャッジ時間 | 16,232 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
class Fenwick_Tree:def __init__(self, n):self._n = nself.data = [0] * ndef add(self, p, x):assert 0 <= p < self._np += 1while p <= self._n:self.data[p - 1] += xp += p & -pdef sum(self, r):s = 0while r > 0:s += self.data[r - 1]r -= r & -rreturn sn, b, q = map(int, input().split())f = Fenwick_Tree(n + 1)for i in range(q):l, m, r = map(int, input().split())f.add(l - 1, 1)f.add(r, -1)x = f.sum(m)print((x + 1) % b, pow(3, x - 1, b) * (x * x + 3 * x + 3) % b, pow(3, x, b))