포럼
문제 ICPC00292

K. Keyboard Queries

설명

Katrín and her friends are university students, and they go to a seminar every week. At the start of each seminar, the professor divides the students into groups randomly. Katrín and her friends dislike random groups, they want to form a group together so they can chat with each other and not get to know the other students. The professor has a secret string \(S\) consisting of \(n\) characters on their computer. This string acts as a seed for the random group generation. When generating groups, a program |manager| is ran with a substring of \(S\) as input. But sometimes, the professor mistypes and writes |manacher| instead. This will indicate that the substring is a palindrome. Maybe Katrín can use this information to predict what the group division will look like?

There is a secret string \(S\) with \(n\) characters in an unknown alphabet. You are given \(q\) queries of two types.
- |1 l r|: This means that the substring of \(S\) at indices \(l\) through \(r\) is a palindrome.
- |2 a b x y|: This means that you should determine whether the substring at indices \(a\) though \(b\) is equal to the substring at indices \(x\) through \(y\), given the information in the previous queries.

제약
입력 형식

The first line of input contains two integers \(n\) and \(q\) (\(1 \leq n \leq 10^5\), \(1 \leq q \leq 2 \cdot 10^5\)), the number of characters in the unknown string and the number of queries.

The following \(q\) lines each start with a \(1\) or a \(2\) indicating the type of query. For queries of type \(1\), two integers \(l\) and \(r\) follow (\(1 \leq l \leq r \leq n\)), meaning that the corresponding substring of \(S\) is a palindrome. For queries of type \(2\), four integers \(a,b,x,y\) follow (\(1 \leq a \leq b \leq n\), \(1 \leq x \leq y \leq n\)), meaning that you should determine whether those two substrings are equal or not.

출력 형식

For each query of the second kind print "Equal" if the substrings must be equal, "Not equal" if the substrings can't be equal, and "Unknown" if either possibility could be true given the information thus far.

예제 1
입력
6 8
1 1 6
2 1 1 6 6
2 1 2 5 6
2 1 3 5 6
1 1 3
2 1 3 4 6
2 4 4 6 6
2 2 3 4 5
출력
Equal
Unknown
Not equal
Equal
Equal
Unknown
문제 정보

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

출처 ICPC NCPC 2022

평가 및 의견

K. Keyboard Queries

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

Log in to rate problems.

개별 의견

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

풀이 제출

K. Keyboard Queries

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