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

19060번 - Secret Permutation 다국어인터랙티브

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB5612919.565%

문제

This is an interactive problem.

There is a secret permutation $p$ of integers from 0ドル$ to $n - 1$. The permutation is indexed starting from 0ドル$. You have to guess it by asking questions of the form "? $a_i$ $b_i$ $c_i$" ($a_i,ドル $b_i$ and $c_i$ are integers from 0ドル$ to $n - 1$). For each such question, you will get one number in response which equals $p^{-1} (p (a_i) \cdot p (b_i) + p (c_i))$ (all operations are performed modulo $n,ドル and $p^{-1} (x)$ is such $y$ that $p (y) = x$). In the end, you have to print the guessed permutation in the form "! $p (0)$ $p (1)$ $\ldots$ $p (n - 1)$".

입력

The only line of the input contains an integer $n$ (1ドル \leq n \leq 5 \cdot 10^3$).

In each test, the permutation is fixed in before the contest and does not change during the guessing process.

For each test, the length $n$ was picked by the jury, but the permutation was then generated using a pseudorandom number generator. However, the problem has a deterministic solution which works for every possible permutation.

출력

제한

프로토콜

You can ask zero or more questions and make exactly one guess in the end. Print each query on a separate line and do not forget to flush the output buffer. The maximum allowed number of queries, including the final guess, is 12ドル,512円$.

예제 입력 1

4
3
2
1

예제 출력 1

? 1 2 3
? 0 3 3
? 0 0 1
! 2 0 3 1

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2017 > Day 3: Ural Contest F번

Contest > Open Cup > 2017/2018 Season > Stage 2: Grand Prix of Ural F번

채점 및 기타 정보

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

출처

대학교 대회

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

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