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

26405번 - Decent Sequence 스페셜 저지다국어

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

문제

The array $a$ is decent if it can be split into two consecutive parts (possibly empty), such that the first one (the prefix) is non-decreasing, and the second (the suffix) is non-increasing. For example, $[1, 2, 3],ドル $[1, 2, 2, 1]$ and $[3]$ are decent, while $[3, 2, 2, 8]$ is not.

There is an array $a$ consisting of $n$ integers, which is not given to you. You are, however, given $n$ integers $l_i$ and $n$ integers $r_i$. It is known that for all indices $i$ from 1ドル$ to $n$ we have $l_i \leq a_i \leq r_i$. Is $a$ decent?

You have to give one of the three answers:

  1. $a$ is definitely decent.
  2. $a$ is definitely not decent.
  3. Neither of the above is the case.

입력

The first line contains a single integer $n$ (1ドル \leq n \leq 10^6$), the length of $a$.

Each of the following $n$ lines contains two integers $l_i$ and $r_i$ (1ドル \leq l_i \leq r_i \leq 10^9$) describing the range containing the element $a_i$.

출력

Output "TAK" (without quotes) if $a$ is definitely decent.

Output "NEIN" (without quotes) if $a$ is definitely not decent.

Output an arbitary string consisting of at least five but not more than 100 lowercase or capital english letters otherwise. If you output something really inappropriate you might get Presentation Error. Both of the possible answers in the samples are not considered inappropriate.

제한

예제 입력 1

3
3 4
2 5
1 1

예제 출력 1

TAK

예제 입력 2

4
3 4
1 3
1 2
3 10

예제 출력 2

NEIN

예제 입력 3

3
1 10
1 10
1 10

예제 출력 3

NEITHER

예제 입력 4

4
1 2
1 1
1 1
1 2

예제 출력 4

Secret

힌트

출처

Camp > Moscow Pre-Finals ACM ICPC Workshop > Moscow Pre-Finals ACM ICPC Workshop 2018 D번

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

출처

대학교 대회

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

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