luogu#P8052. [ZYOI Round1] Truth/真心话大冒险

[ZYOI Round1] Truth/真心话大冒险

Background

Note: Please do not submit code maliciously and waste judging resources.

A group of people are at a party, playing “Truth or Dare”.

Problem Description

Charlie is now targeting someone named Percy. They plan to determine Percy’s ranking of favorability toward nn people of the opposite sex.

Specifically, Charlie can make two types of requests:

  1. [Truth] Given 33 positive integers x,y,zx, y, z, Percy must answer the ID of the person he likes the second most among these three. Constraints: 1x,y,zn1 \le x, y, z \le n.

  2. [Dare] Given 22 positive integers x,yx, y, Percy must hug the one he likes more between them. Constraints: 1x,yn1 \le x, y \le n, and it is guaranteed that among x,yx, y, at least one is Percy’s favorite overall.

Charlie wants to achieve his goal using at most 2×1062 \times 10^6 queries.

Interactive format:

At the beginning, read one positive integer nn to start the interaction.

You may output three types of messages:

  1. 1 x y z, which represents a “Truth” query, then read the result.
  2. 2 x y, which represents a “Dare” query, then read the result.
  3. 3 a1 a2 ... an, which means you have obtained the answer. Output, in order, the IDs of Percy’s favorite, second favorite, ..., up to the nn-th favorite.

Input Format

(See the Description section.)

Output Format

(See the Description section.)

5

3

5

1 1 2 3

2 1 5

3 5 2 4 3 1

Hint

The above input and output are only to demonstrate the interactive format, and may not be logically consistent.

For 20%20\% of the testdata, 1n101 \le n \le 10.

For 40%40\% of the testdata, 1n1001 \le n \le 100.

For 60%60\% of the testdata, 1n1031 \le n \le 10^3.

For 80%80\% of the testdata, 1n1041 \le n \le 10^4.

For 100%100\% of the testdata, 1n2×1041 \le n \le 2 \times 10^4.

Note that invalid output may cause mysterious issues such as WA / RE / TLE / MLE.

Translated by ChatGPT 5