#C2124. Minimize Geometric Attraction

    ID: 45406 Type: Default 1000ms 256MiB

Minimize Geometric Attraction

Minimize Geometric Attraction

You are given three integers M, P, and Q along with an array B of size M and a list of Q multipliers. Your task is to choose a geometric progression characterized by its first term a and common ratio r, and then perform a sequence of operations. The first line of the output should contain the chosen values a and r separated by a space. Then, perform exactly P operations of type 1 and Q operations of type 2 as follows:

  • For each type 1 operation, print a line with three integers: 1 1 M, where M is the length of the array.
  • For each type 2 operation (in order), print a line with three integers: 2 i x, where i is the 1-indexed operation number and x is the corresponding multiplier from the input.

Finally, output a line containing -1 to signal the end of operations.

Note: For the purpose of this problem, choose a = B[0] and r = B[1] / B[0] (using integer division). It is guaranteed that M >= 1 and, if M > 1, then B[0] divides B[1].

inputFormat

The input is read from stdin and consists of three lines:

  • The first line contains three integers M, P, and Q separated by spaces.
  • The second line contains M space-separated integers representing the array B.
  • The third line contains Q space-separated integers representing the multipliers.

outputFormat

The output should be written to stdout and consist of multiple lines:

  • The first line contains two integers a and r separated by a space.
  • The next P lines each contain an operation of type 1 in the format: 1 1 M.
  • The following Q lines each contain an operation of type 2 in the format: 2 i x, where i is the 1-indexed number of the operation and x is the corresponding multiplier.
  • The final line must contain -1 to indicate the end of operations.
## sample
4 2 2
4 16 64 256
3 2
4 4

1 1 4 1 1 4 2 1 3 2 2 2 -1

</p>