题目收集
题目列表题单
返回列表

Hard Performance Measurement (A+B)

CodeforcesP0033· 1000ms· 256 MB· ZJU Summer 2026 Contest 3原题链接
构造

创建于 2026/07/16 · 更新于 2026/07/17

题目描述

This is an interactive problem.

The interactor will first give you an integer nnn. You need to output an positive integer xxx and a strictly increasing positive integer array a1…na_{1\dots n}a1…n​. You must ensure that there do NOT exist two distinct elements in a1…na_{1\dots n}a1…n​ whose sum is xxx.

Then, the interactor will give you an index iii between iii and nnn, and you need to change aia_iai​ to another positive integer, such that after the modification, a1…na_{1\dots n}a1…n​ is still strictly increasing, but there exist two distinct elements whose sum is xxx.

Both xxx and all the elements in a1…na_{1\dots n}a1…n​ should not exceed 10910^9109.

输入格式

The input contains several test cases.

The first line of the input contains a single integer TTT, the number of test cases.

For each test case:

  • The interactor provides a line first with integer nnn.
  • Your program must output exactly three lines:
    • Line 1: the integer xxx.
    • Line 2: nnn space-separated integers a1,a2,…,ana_1,a_2,\dots ,a_na1​,a2​,…,an​.
    • After printing the two lines above, the interactor sends a line containing integer iii. Your program must then output Line 3: a single integer aia_iai​, the new value assigned to aia_iai​.

Remember to flush the output buffer after each print (e.g., fflush(stdout) in C/C++, sys.stdout.flush() in Python, cout.flush() in C++).

It's guaranteed that 1≤T≤1061\leq T\leq 10^61≤T≤106, 2≤n≤1062\leq n\leq 10^62≤n≤106 and ∑n≤106\sum n\leq 10^6∑n≤106.

样例输入 #1

2

3
2

4
1

样例输出 #1

6
1 4 9
5

7
1 4 7 10
3