Universal Cup Judging System

Universal Cup

実行時間制限: 2.0 s メモリ制限: 1024 MB 満点: 100 インタラクティブ
統計

呢個係一道交互題(你嘅程式同評測系統透過輸入同輸出進行交互)。

一個整數序列被稱為非零序列,如果佢同時滿足以下兩個條件:

  • 任何兩個元素都係互不相同嘅。
  • 任何非空(唔一定連續)子序列嘅和都唔等於 $0$。

例如,$(5)$、$(1, -2, 3)$ 同 $(-3, 7, 5, -6)$ 係非零序列,而 $(0)$、$(1, -3, 1)$、$(2, 3, -2)$ 同 $(1, 2, 3, -4)$ 就唔係。

畀你正整數 $N$ 同 $X$。

從頭開始逐個輸出一個長度為 $X = 2\lfloor\sqrt{N}\rfloor - 1$ 嘅非零序列 $(A_1, A_2, \dots, A_X)$ 嘅元素,呢個序列由介乎 $-N$ 同 $N$ 之間(包含兩端)嘅整數組成。不過,每個元素嘅正負號會喺佢輸出之前即刻指定。

畀你 $R$ 組測試數據;請對每組測試數據同評測機進行交互。

輸入格式

  • $1 \le R \le 10^4$
  • $1 \le N \le 10^4$
  • $X = 2\lfloor\sqrt{N}\rfloor - 1$
  • 所有測試數據中 $N$ 嘅總和唔超過 $10^4$

交互格式

首先,按以下格式畀出測試數據嘅組數 $R$:

R

然後,以下交互會重複 $R$ 次。

對於每組測試數據,按以下格式畀出正整數 $N$ 同 $X$:

N X

之後,對於每個 $i = 1, 2, \dots, X$(按呢個順序),進行以下交互。

首先,按以下格式畀出 $A_i$ 嘅符號 $op_i$:

op_i

$op_i$ 為 + 或 - 之一,含義如下:

  • 如果 $op_i = \text{+}$,則 $A_i$ 必須係一個正整數。
  • 如果 $op_i = \text{-}$,則 $A_i$ 必須係一個負整數。

然後,喺單行入面輸出一個介乎 $-N$ 同 $N$ 之間(包含兩端)且滿足指定符號嘅整數 $A_i$(對於正整數,你唔需要印出正號):

A_i

提示

喺每次輸出之後,你嘅程式必須刷新標準輸出(flush);否則,你將會收到 Time Limit Exceeded(超時)。

範例

輸入範例 1

2
4 3
-
-
+
3 1
+

輸出範例 1

-4
-1
2
3

提示

以下係範例交互嘅詳細過程:

輸入 輸出 解釋
2 畀出測試數據組數 $R$。
4 3 畀出第一組測試數據嘅 $N, X$。
- 因為 $op_1 = \text{-}$,$A_1$ 必須係一個負整數。
-4 你輸出 $A_1 = -4$。
- 因為 $op_2 = \text{-}$,$A_2$ 必須係一個負整數。
-1 你輸出 $A_2 = -1$。
+ 因為 $op_3 = \text{+}$,$A_3$ 必須係一個正整數。
2 你輸出 $A_3 = 2$。由於 $(A_1, A_2, A_3) = (-4, -1, 2)$ 係一個非零序列,呢組測試數據被判定為正確。
3 1 畀出第二組測試數據嘅 $N, X$。
+ 因為 $op_1 = \text{+}$,$A_1$ 必須係一個正整數。
3 你輸出 $A_1 = 3$。由於 $(A_1) = (3)$ 係一個非零序列,呢組測試數據被判定為正確。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.