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

30902번 - Exponentiation 다국어

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

문제

In her spare time, Zoe develops an online calculator. Unfortunately, the calculator was targeted by a denial-of-service attack last week. The attacker created a lot of integer variables, exponentiated them with each other, and tried to do a bunch of comparisons. The huge integers were too much for the server to handle, so it crashed. Before Zoe fixes the issue, she decides to actually perform the calculations that the attacker requested.

There are $n$ integer variables $x_1, x_2, \dots, x_n$. At the start, each variable is set to 2023ドル$. You have to perform $m$ instructions of the following two types:

  • Operations, of the form "! $i$ $j$", where $i \neq j$. This means that $x_i$ gets set to $x_i^{x_j}$.
  • Queries, of the form "? $i$ $j$", where $i \neq j$. This means that you should print '>' if $x_i$ is greater than $x_j,ドル '=' if $x_i$ is equal to $x_j,ドル and '<' if $x_i$ is smaller than $x_j$.

Consider the first sample. After the 5ドル$ operations, the values of the variables are: $$\begin{align*} x_1&=\left({2023}^{2023}\right)^{{2023}^{2023}},& x_2&=\left({2023}^{{2023}^{2023}}\right)^{2023},& x_3&={2023},& x_4&={2023}^{2023}. \end{align*}$$

입력

The input consists of:

  • One line with two integers $n$ and $m$ (2ドル \leq n \leq 1000,ドル 1ドル \leq m \leq 1000$), the number of variables and the number of instructions.
  • $m$ lines, each containing a character $c$ (either '!' or '?') and two integers $i$ and $j$ (1ドル \leq i, j \leq n,ドル $i \neq j$), describing the instructions.

출력

For every query in the input, output its answer.

제한

예제 입력 1

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

예제 출력 1

<
>
=

예제 입력 2

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

예제 출력 2

<
>
>
<

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2023 E번

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

출처

대학교 대회

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

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