#P13980. 数列分块入门 5
数列分块入门 5
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 square root and range sum.
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 three integers , separated by spaces.
If , it means that every number in is replaced by its square root. For each in the range , $a_i \leftarrow \left\lfloor \sqrt{a_i}\right\rfloor$.
If , it means that you should query the sum of all numbers in .
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 4
0 1 2
1 1 2
6
2
Hint
Subtasks
Subtask 1 (40 points): , .
Subtask 2 (60 points): , , .
For all testdata, and , . . , . After each operation every satisfies .
Translated by QwenWork