#P9986. [Ynoi2079] r2pspc

[Ynoi2079] r2pspc

Problem Description

Given a sequence a1,,ana_1,\dots,a_n and mm queries, each query asks for the number of 11 bits in the binary representation of i=lr2ai\sum\limits_{i=l}^r 2^{a_i}.

Input Format

The first line contains two integers n,mn, m.

The second line contains nn integers a1,,ana_1,\dots,a_n.

The next mm lines each contain l,rl, r, representing one query.

Output Format

Output mm lines. Each line is the answer to the corresponding query.

5 2
2 3 1 2 32
2 5
2 5
4
4

Hint

Idea: rushcheyo, Solution: djq_cpp&ccz181078, Code: ccz181078, Data: ccz181078.

Constraints: For 100%100\% of the testdata, 1n1051\le n\le {10}^5, 1m1061\le m\le {10}^6, 1ai1091\le a_i\le 10^9, 1lrn1\le l\le r\le n.

For 25%25\% of the testdata, n,m1000n, m\le 1000.

For another 25%25\% of the testdata, ai100a_i\le 100.

For another 25%25\% of the testdata, m105m\le 10^5.

For the remaining 25%25\% of the testdata, there are no special constraints.

Translated by ChatGPT 5