Describe
- Lostmonkey on the ground along a straight line to put n devices, each device set the initial elastic coefficient ki, when the sheep reached the first device, it will bounce Ki step back to the first I+ki device, if there is no i+ki device, the sheep are bounced. The sheep wanted to know that when it started from the device I, it was bounced a few times. In order to make the game more interesting, Lostmonkey can modify the elastic coefficient of an elastic device, and the elastic coefficient is a positive integer at any time.
Analysis
- The block, maintenance I position of the sheep after several pop-up the Block (f[]), as well as where to fall after the pop-up (arv[]). This will allow you to complete the subject in n√n time.
- When the query operation is encountered, each ans plus f[i], I transfer to arv[i], until Arv[i]≥n
- When a modification is encountered, only the f[] array and the arv[] array of the block are maintained.
- Maintenance without a point of calculation, but from backward forward backward.
- I practiced the shot and generated the data, and found the error by the PAT.
Bzoj-2002-bounce projectile Fly Sheep-chunking