atcoder#ARC086B. [ABC081D] Non-decreasing

[ABC081D] Non-decreasing

Score : 600600 points

Problem Statement

Snuke has an integer sequence, aa, of length NN. The ii-th element of aa (11-indexed) is aia_{i}.

He can perform the following operation any number of times:

  • Operation: Choose integers xx and yy between 11 and NN (inclusive), and add axa_x to aya_y.

He would like to perform this operation between 00 and 2N2N times (inclusive) so that aa satisfies the condition below. Show one such sequence of operations. It can be proved that such a sequence of operations always exists under the constraints in this problem.

  • Condition: a1a2...aNa_1 \leq a_2 \leq ... \leq a_{N}

Constraints

  • 2N502 \leq N \leq 50
  • 106ai106-10^{6} \leq a_i \leq 10^{6}
  • All input values are integers.

Input

Input is given from Standard Input in the following format:

NN

a1a_1 a2a_2 ...... aNa_{N}

Output

Let mm be the number of operations in your solution. In the first line, print mm. In the ii-th of the subsequent mm lines, print the numbers xx and yy chosen in the ii-th operation, with a space in between. The output will be considered correct if mm is between 00 and 2N2N (inclusive) and aa satisfies the condition after the mm operations.

3
-2 5 -1
2
2 3
3 3
  • After the first operation, a=(2,5,4)a = (-2,5,4).
  • After the second operation, a=(2,5,8)a = (-2,5,8), and the condition is now satisfied.
2
-1 -3
1
2 1
  • After the first operation, a=(4,3)a = (-4,-3) and the condition is now satisfied.
5
0 0 0 0 0
0
  • The condition is satisfied already in the beginning.