포럼
문제 ICPC00215

E. Exponentiation

설명

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: align x_1&=(20232023)2023^2023,& x_2&=(202320232023)^2023,& x_3&=2023,& x_4&=2023^2023. 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
출력
<
>
=
예제 2
입력
4 9
! 2 4
! 1 2
? 3 1
? 1 2
! 2 3
? 1 2
! 1 3
! 3 2
? 1 3
출력
<
>
>
<
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC NWERC 2023

평가 및 의견

E. Exponentiation

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

E. Exponentiation

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8