Universal Cup Judging System

Universal Cup

Time Limit: 2.0 s Memory Limit: 1024 MB Total points: 100 Interactive
Statistics

這是一道互動題(您的程式與評測系統透過輸入和輸出進行互動)。

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

  • 任何兩個元素都是不同的(互不相同)。
  • 任何非空(不一定連續)子序列的和都不等於 $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.