#P5783. [CQOI2008] 位统计
[CQOI2008] 位统计
Description
Given integers in , write a program that supports the following operations:
Modification operation: C d, add to every number. If the result exceeds , take the result modulo . ()
Query operation: Q i, count how many integers have a nonzero -th bit. In other words, count how many integers have a positive result when applying the bitwise AND with . ()
Output the counts for all query operations.
Input Format
The first line contains two positive integers and , which are the number of integers and the number of operations.
The second line contains integers in .
The next lines each contain one operation, in the format described above.
Output Format
Output the count for every Q operation.
3 5
1 2 4
Q 1
Q 2
C 1
Q 1
Q 2
1
1
2
1
Hint
Constraints
| Test Point ID | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
Translated by ChatGPT 5
京公网安备 11011102002149号