当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7059:Counting Stars

题目描述
As an elegant and accomplished girl, Bella loves watching stars at night (especially the Polaris). There are totally $n$ stars in the sky. We can define $a_i$ as the initial $brightness$ of $i$-th star.

At $t$-th second, the $brightness$ of some stars may change due to stars' activity. To simplify this problem, we can approximately divide activities into two kinds:

1. $\forall i \in [l,r]$ , the $brightness$ of $i$-th star decreases by $a_i \& (-a_i)$
2. $\forall i \in [l,r], a_i \neq 0$ , the $brightness$ of $i$-th star increases by $2^k$, where $k$ satisfy $2^k\leq a_i < 2^{k+1}$

Also, Bella has some queries. For each query, she wants to know the $sum$ of $brightness$ of stars in the range $[l,r]$, which means $\sum_{i=l}^r a_i$

As we all know, Bella is a big smart. Thus, she could not solve such difficult problem by herself. Please help her solve this problem and answer her queries.

Since the answer may be too large, please output the answer modulo $998244353$
输入解释
The first line contains an integer $T(T \leq 5)$ , denoting the number of test cases.

For each test case:

The first line contains an integers $n(1 \leq n \leq 100000)$, denoting the number of stars .

The second line contains $n$ integers $a_1,a_2,\dots,a_n (1 \leq a_i \leq 10^9)$, denoting the initial $brightness$ of stars.

The third line contains an integer $q(1 \leq q \leq 100000)$, denoting the number of operations.

Each of the next $q$ lines contains three integers $opt_i,l_i,r_i$, denoting the kind of operations and ranges.

$opt_i=1$ means Bella's query.

$opt_i=2$ means the first kind of stars' activity.

$opt_i=3$ means the second kind of stars' activity.

It is guaranteed that for all test cases, $\sum n \leq 4 \times 10^5,\sum q \leq 4 \times 10^5$.
输出解释
For each Bella's query, output the answer modulo $998244353$ in a single line.
输入样例
1

5

5 2 2 9 7

4

2 1 5

1 1 1

3 1 3

1 2 5
输出样例
4

14

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7059

最后修改于 2021-10-23T19:11:14+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
8000/4000MS(Java/Others) 131072/131072K(Java/Others)