Logo
(追記) (追記ここまで)

3503번 - Interactive Permutation Guessing 다국어인터랙티브

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB165252214.474%

문제

There is a permutation a of size n that you have to guess interactively.

You are allowed to make queries of the following kind. You output any permutation b of size n. The information given back to you is the length of the longest common subsequence of permutations a and b.

프로토콜

First, your program must read from the standard input one line with integer n, the size of the permutation you have to guess.

Your program must then write to the standard output one line with a permutation and wait for a line in the standard input with a response, then write next query and read next response, and so on until you know a.

Once you receive response n (which means you’ve found a), you’re done and your program must exit.

입력

The first line of the standard input contains integer n, the size of the permutation (1 ≤ n ≤ 40).

Each of the next lines of the standard input contains response to your query — the length of the longest common subsequence of the permutation queried by you and the permutation a.

출력

Each line of the standard output should contain a space-separated list of integers that form a permutation you’re querying.

Your can make at most 5n2 queries.

You must flush the standard output after printing each line. You must not print any lines after you receive the response n, just exit.

제한

예제 입력 1

4
3
2
2
4

예제 출력 1

1 2 3 4
1 3 4 2
4 1 2 3
3 1 2 4

힌트

출처

ICPC > Regionals > Northern Eurasia > Northern Eurasia Finals > NEERC 2011 I번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /