CF938C.Constructing Tests

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Let's denote a mm -free matrix as a binary (that is, consisting of only 11 's and 00 's) matrix such that every square submatrix of size m×mm×m of this matrix contains at least one zero.

Consider the following problem:

You are given two integers nn and mm . You have to construct an mm -free square matrix of size n×nn×n such that the number of 11 's in this matrix is maximum possible. Print the maximum possible number of 11 's in such matrix.

You don't have to solve this problem. Instead, you have to construct a few tests for it.

You will be given tt numbers x1x_{1} , x2x_{2} , ..., xtx_{t} . For every , find two integers nin_{i} and mim_{i} ( ni>=min_{i}>=m_{i} ) such that the answer for the aforementioned problem is exactly xix_{i} if we set n=nin=n_{i} and m=mim=m_{i} .

输入格式

The first line contains one integer tt ( 1<=t<=1001<=t<=100 ) — the number of tests you have to construct.

Then tt lines follow, ii -th line containing one integer xix_{i} ( 0<=xi<=1090<=x_{i}<=10^{9} ).

Note that in hacks you have to set t=1t=1 .

输出格式

For each test you have to construct, output two positive numbers nin_{i} and mim_{i} ( 1<=mi<=ni<=1091<=m_{i}<=n_{i}<=10^{9} ) such that the maximum number of 11 's in a mim_{i} -free ni×nin_{i}×n_{i} matrix is exactly xix_{i} . If there are multiple solutions, you may output any of them; and if this is impossible to construct a test, output a single integer 1-1 .

输入输出样例

  • 输入#1

    3
    21
    0
    1
    

    输出#1

    5 2
    1 1
    -1
    
首页