#SGM0000026. Truy vấn lương (Salary Queries)
Truy vấn lương (Salary Queries)
Salary Queries
Source: CSES
Version: Phuoc Hung OJ Extended
Problem Statement
A company has employees, and employee currently has salary . Process queries:
! k x: change employee 's salary to .? a b: count employees whose salary is in .
Input
The first line contains .
The second line contains .
The next lines contain the queries.
Output
For every ? query, print the required count.
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: , and all salary values/query bounds are in .
Examples
Input
5 3
3 7 2 2 5
? 2 3
! 3 6
? 2 3
Output
3
2
Explanation
The sample is processed in order; every printed item/line corresponds to an operation that requires output.