Progression
Time limit1sMemory limit1024 MB
Given N mission difficulties with range updates that add or assign arithmetic progressions, find the longest arithmetic run inside a query range.
- Level
Hard8 of 10
- Topics
- Segment tree, Array, Implementation
- Solved
- No attempts yet
Problem
Damian is making a video game with missions. The initial difficulty of mission is . The game can be played both forwards and backwards. Damian performs two kinds of operations. A patch operation is given as , , , , , and it increases the difficulty of every mission with by . A rewrite operation is given as , , , , , and it sets the difficulty of every mission with to .
Playable segments and queries
Missions through (where ) form a playable segment if there is an integer such that for every . The value may be zero or negative. A single mission is a playable segment of length . An evaluate query is given as , , . For that query, find the length of the longest playable segment inside missions through , using the difficulties at that moment.