Universal Cup Judging System

Universal Cup

Límite de tiempo: 1.0 s Límite de memoria: 256 MB Puntuación total: 100 Interactivo
Estadísticas

呢個係一道交互題!

存在一個由 $N$ 個互不相同嘅正整數組成嘅隱藏陣列 $a_1, a_2, \dots, a_N$(其中 $N$ 係奇數);呢個陣列嘅一個錯誤副本儲存喺另一個隱藏陣列 $b$ 入面。陣列 $b$ 嘅每個元素定義如下:

  • $b_1 = a_2$
  • $b_N = a_{N-1}$
  • 對於每個滿足 $1 < i < N$ 嘅 $i$,$b_i = a_{i-1}$ 或者 $b_i = a_{i+1}$(即係相鄰元素之一)

你需要確定係咪存在兩個下標 $i$ 同 $j$($i \neq j$,$1 \le i, j \le N$)令到 $b_i = b_j$。如果存在噉樣嘅下標,請返回佢哋;否則,指出唔存在噉樣嘅下標。

你可以透過以下操作查詢陣列 $a$ 同 $b$ 嘅元素:

  • 1 i:返回 $a_i$ 嘅值($1 \le a_i \le 10^9$)
  • 2 i:返回 $b_i$ 嘅值($1 \le b_i \le 10^9$)

你最多可以進行 20 次查詢。

交互協議

首先,你必須讀取一行,包含一個整數 $T$($1 \le T \le 100$),代表測試用例嘅數量。

接住係 $T$ 個測試用例嘅交互過程。

對於每個測試用例,你必須首先讀取一行,包含一個整數 $N$($3 \le N \le 2\,001$,$N$ 係奇數)。

然後交互開始。你可以輸出一行,包含以下內容之一:

  • 1 x(詢問 $a_x$):然後,讀取一行,包含一個整數 $a_x$。
  • 2 x(詢問 $b_x$):然後,讀取一行,包含一個整數 $b_x$。
  • 3 i j(回答:兩個下標 $i, j$,滿足 $b_i = b_j$;如果唔存在噉樣嘅兩個下標,就輸出 -1 -1):然後,如果有下一個測試用例,就繼續進行;否則,程式終止。

喺輸出每一行之後,請唔好忘記清空輸出緩衝區(flush)。例如:

  • C/C++ 入面嘅 fflush(stdout);
  • Java 入面嘅 System.out.flush();
  • Python 入面嘅 sys.stdout.flush();
  • Pascal 入面嘅 flush(output);
  • 其他語言請參閱相應文檔。

範例

輸入 1

1
7
2
2

輸出 1

2 3
2 1
3 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.