QOJ.ac

QOJ

حد الوقت: 7.5 s حد الذاكرة: 1024 MB مجموع النقاط: 100

#4998. 键盘查询

الإحصائيات

Katrín 和她的朋友们是大学生,他们每周都要参加研讨会。在每次研讨会开始时,教授会将学生随机分组。Katrín 和她的朋友们不喜欢随机分组,他们想组成一个小组,这样就可以互相聊天,而不必去认识其他学生。教授的电脑里有一个包含 $n$ 个字符的秘密字符串 $S$。这个字符串作为随机分组的种子。在生成分组时,程序 manager 会以 $S$ 的一个子串作为输入。但有时,教授会打错字,写成 manacher。这表示该子串是一个回文串。也许 Katrín 可以利用这些信息来预测分组的情况?

有一个包含 $n$ 个字符的秘密字符串 $S$,字符集未知。你需要处理 $q$ 个查询,查询分为两类:

  • 1 l r:这意味着 $S$ 从下标 $l$ 到 $r$ 的子串是一个回文串。
  • 2 a b x y:这意味着你需要根据之前查询提供的信息,判断 $S$ 从下标 $a$ 到 $b$ 的子串是否等于从下标 $x$ 到 $y$ 的子串。

输入格式

第一行包含两个整数 $n$ 和 $q$ ($1 \le n \le 10^5$, $1 \le q \le 2 \cdot 10^5$),分别表示未知字符串的字符数和查询次数。

接下来的 $q$ 行,每行以 $1$ 或 $2$ 开头,表示查询类型。对于类型 1 的查询,后面跟着两个整数 $l$ 和 $r$ ($1 \le l \le r \le n$),表示对应的 $S$ 的子串是回文串。对于类型 2 的查询,后面跟着四个整数 $a, b, x, y$ ($1 \le a \le b \le n$, $1 \le x \le y \le n$),表示你需要判断这两个子串是否相等。

输出格式

对于每个第二类查询,如果子串必然相等,则输出 “Equal”;如果子串必然不相等,则输出 “Not equal”;如果根据目前已知信息,两种情况都有可能,则输出 “Unknown”。

样例

输入 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

输出 1

Equal
Unknown
Not equal
Equal
Equal
Unknown

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.