Doggio's Treats

View as PDF

Submit solution

Points: 3
Time limit: 0.5s
Memory limit: 64M

Author:
Problem type

Doggio is an extremely picky eater. He will only eat treats in sets that begin with A, increasing linearly by A after each meal, with A changing every day depending on his mood. Every morning, his owner, Mario, prepares N bags of treats that he will feed Doggio for the day. However, sometimes he accidentally puts the wrong number of treats in a bag. He has hired you to sort through his treats and correct the bags that do not conform to Doggio's standards. As Mario is not completely incompetent, the first bag he prepares will always have the correct number of treats.

Input Specification

The first line of input will contain N (1 \le N \le 10^6), the number of sets of treats Doggio will eat.

The second line of input will contain N space separated integers, the number of treats that Mario has put in each set. The numbers start at A (1 \le A \le 10^3) and increases by A each time, except when Mario puts the incorrect number of treats for that set.

It is guaranteed that for each set of treats, the number of treats will fit into an integer.

Output Specification

Print the location of the sets that has the incorrect number of treats (0 indexed), as well as the number of treats it should actually have. If there is more than one set that is incorrect, print on a new line.

Sample Input

8
3 6 8 9 15 18 21 24

Sample Output

2 9
3 12

Comments

There are no comments at the moment.