CF1637G.Birthday

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vitaly gave Maxim nn numbers 1,2,,n1, 2, \ldots, n for his 1616 -th birthday. Maxim was tired of playing board games during the celebration, so he decided to play with these numbers. In one step Maxim can choose two numbers xx and yy from the numbers he has, throw them away, and add two numbers x+yx + y and xy|x - y| instead. He wants all his numbers to be equal after several steps and the sum of the numbers to be minimal.

Help Maxim to find a solution. Maxim's friends don't want to wait long, so the number of steps in the solution should not exceed 20n20n . It is guaranteed that under the given constraints, if a solution exists, then there exists a solution that makes all numbers equal, minimizes their sum, and spends no more than 20n20n moves.

输入格式

The first line contains a single integer tt ( 1t250001 \le t \le 25\,000 ) — the number of test cases.

Each test case contains a single integer nn ( 2n51042 \le n \le 5 \cdot 10^4 ) — the number of integers given to Maxim.

It is guaranteed that the total sum of nn doesn't exceed 51045 \cdot 10^4 .

输出格式

For each test case print 1-1 if it's impossible to make all numbers equal.

Otherwise print a single integer ss ( 0s20n0 \le s \le 20n ) — the number of steps. Then print ss lines. The ii -th line must contain two integers xix_i and yiy_i — numbers that Maxim chooses on the ii -th step. The numbers must become equal after all operations.

Don't forget that you not only need to make all numbers equal, but also minimize their sum. It is guaranteed that under the given constraints, if a solution exists, then there exists a solution that makes all numbers equal, minimizes their sum, and spends no more than 20n20n moves.

输入输出样例

  • 输入#1

    2
    2
    3

    输出#1

    -1
    3
    1 3
    2 2
    4 0
首页