Find the Permutation (findperm)

14 teams scored 1377 points on this task, for a maximum score of 100, an average score of 98 and a median score of 100.

Highlights

  1. Galilei, Verona is the institute with the most points (100).
  2. Lombardia is the region with the most points (477).

Statement

This is an interactive problem. Your program communicates with the evaluator: it should alternately write messages to the evaluator on the standard output and read the next input from the standard input. There is a hidden permutation P = [P_1, P_2, …, P_N] of the numbers 1, 2, …, N. You can ask questions in the form (i, j) with 1 ≤ i, j ≤ N. Note that i and j does not have to be distinct. The evaluator responds with the most significant bit of the bitwise AND of P_i and P_j. and y=13 = 1101_(2), then their bitwise AND will be 9 = 1001_(2). Here, the most significant bit of a number x is the exponent of the highest power of 2 that appears when writing x in base 2. For example, the most significant bit of 5 = 101_(2) is 2, since 2^2 appears in the binary representation of 5. If the bitwise AND of P_i and P_j is 0, the evaluator responds with -1. Your task is to determine the hidden permutation of at most 1000 numbers by asking no more than \constraints30000 questions.