Problem A. Mines
Input file: standard input
Output file: standard output
Time limit: 10 seconds
There are N mines on the number line. Mine i is at position pi and has an explosion radius ri. It initially | |
costs ci to detonate. If mine i is detonated, an explosion occurs on interval [pi - ri; pi + ri] and all mines | |
in that interval (inclusive of the endpoints) are detonated for free, setting off a chain reaction. You need | |
to process Q operations of the form (m; c): Change the cost of detonating mine m to c. Output the | |
minimum cost required to detonate all mines after each change. Note that each change is permanent. |
Input |
The first line contains integers N and Q (1 ≤ N; Q ≤ 200 000). The next N lines contain information on the mines. The i-th of these lines contains integ |