CF13E Holes
Description
Little Petya likes to play a lot. Most of all he likes to play a game «Holes». This is a game for one person with following rules:
There are $ N $ holes located in a single row and numbered from left to right with numbers from 1 to $ N $ . Each hole has it's own power (hole number $ i $ has the power $ a_{i} $ ). If you throw a ball into hole $ i $ it will immediately jump to hole $ i+a_{i} $ , then it will jump out of it and so on. If there is no hole with such number, the ball will just jump out of the row. On each of the $ M $ moves the player can perform one of two actions:
- Set the power of the hole $ a $ to value $ b $ .
- Throw a ball into the hole $ a $ and count the number of jumps of a ball before it jump out of the row and also write down the number of the hole from which it jumped out just before leaving the row.
Petya is not good at math, so, as you have already guessed, you are to perform all computations.
Input Format
N/A
Output Format
N/A