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

30888번 - Cheese Comparison 다국어인터랙티브

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 (추가 시간 없음) 1024 MB65392961.702%

문제

Every Thursday, the big square in front of the New Church in Delft is filled with market stands. Today, you brought your formidable cheese wheels\footnotemark{} to the market for the first time, and to optimize sales, you need to position your cheese wheels in an appealing way. From your experience of playing with blocks as a child, you know that the cheese wheels will look most appealing when they are ordered by weight, from small to large.1

Ordering the cheese wheels would have been easy, if you had brought your highly accurate digital cheese-weighing scale. However, due to unfortunate planning at your cheese factory, you only have a balancing scale with you. The market is already starting to fill up with potential customers, so you hurriedly start comparing cheese wheels to order them from lightest to heaviest.


1A cheese wheel is large, circular, typically yellow, has a crust on the outside to keep the cheese inside fresh, and can weigh several kilos.

입력

출력

제한

인터랙션

This is an interactive problem. Your submission will be run against an interactor, which reads from the standard output of your submission and writes to the standard input of your submission. This interaction needs to follow a specific protocol:

The interactor first sends one line with an integer $n$ (1ドル \le n \le 100$), the number of cheese wheels.

Then, your program needs to order the cheese wheels by weight. The weight of two cheese wheels can be compared by printing one line of the form "? $i$ $j$" (1ドル \le i,j \le n$), indicating you want to compare the weights of cheese wheels $i$ and $j$. The interactor will respond with '<' if cheese wheel $i$ is lighter than cheese wheel $j,ドル '=' if they have the same weight, or '>' if cheese wheel $i$ is heavier than cheese wheel $j$.

Once you have determined the order of the cheese wheels, print one line of the form "! $a_1$ $\dots$ $a_n$" (1ドル\leq a_i \leq n$ for 1ドル \le i \le n$), indicating the order of the cheese wheels from light to heavy, after which the interaction will stop. Printing the answer does not count as a query.

If there are multiple valid solutions, you may output any one of them.

The interactor is not adaptive: the weights of all cheese wheels is determined up-front.

Make sure you flush the buffer after each write.

A testing tool is provided to help you develop your solution.

Making more than 20ドル,000円$ comparisons will result in a wrong answer.

예제 입력 1

4
>
>
>
>
=
<

예제 출력 1

? 2 1
? 2 3
? 2 3
? 1 3
? 4 1
? 4 2
! 3 1 4 2

예제 입력 2

3
=
=

예제 출력 2

? 2 1
? 1 3
! 2 1 3

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2023 연습 세션 PC번

채점 및 기타 정보

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

출처

대학교 대회

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

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