#P13977. 数列分块入门 2
数列分块入门 2
Background
The constraints of the testdata in Luogu's "Introduction to Sequence Block Decomposition" series differ from those of the original problems.
Problem Description
You are given a sequence of length and operations. The operations involve range addition and queries for the number of elements smaller than a value in a range.
Input Format
The first line contains one integer .
The second line contains integers, where the -th integer is , separated by spaces.
Then lines follow, each containing a query. Each line contains four integers , , , , separated by spaces.
If , it means that is added to every number in .
If , it means that you should query the number of elements in that are smaller than .
Output Format
For each query, output one integer on a single line giving the answer.
4
1 2 2 3
0 1 3 1
1 1 3 2
1 1 4 1
1 2 3 2
3
0
2
Hint
Subtasks
Subtask 1 (40 points): , .
Subtask 2 (60 points): , .
For all testdata, and . . The testdata do not guarantee that every satisfies after each operation. .
Translated by QwenWork