#P9410. 『STA - R2』机场修建
『STA - R2』机场修建
Background
Chile is building airports.
Problem Description
There are cities in a line, and at the beginning they are not connected to each other.
Each city initially has no population.
There will be a total of operations / queries as follows:
1 x yOpen a bidirectional flight between city and city .2 l r aThe population of every city in increases by .3 xIf everyone who can reach city comes to city , how many people will city have?
Input Format
The first line contains two integers .
The next lines each contain one operation.
Output Format
For every operation of type , output the answer.
5 5
1 2 4
2 3 5 2
3 2
1 2 5
3 2
2
4
Hint
This problem uses bundled testdata.
- Easy (5 pts): , and there is no operation .
- Normal (10 pts): .
- Hard (20 pts): , and after any operation there is no operation .
- Lunatic (30 pts): .
- Overdrive (35 pts): .
For of the data, , . It is guaranteed that the answer fits in the range of a 64-bit signed integer.

For some reasons, there are many partial scores.
Translated by ChatGPT 5