Universal Cup Judging System

Universal Cup

Límite de tiempo: 8.0 s Límite de memoria: 1024 MB Puntuación total: 100 Hackeable ✓
Estadísticas

Bobo 最近看到了一些形如 $X \ op \ Y$ 的约束条件,其中 $X$ 和 $Y$ 是由数字 $0$ 到 $9$ 和大写英文字母组成的字符串,表示一个数字的十进制表示,$op \in \{<, >, =\}$ 表示运算符。该约束的一个解是指为 $26$ 个大写英文字母中的每一个分配 $0-9$ 的值,使得所有约束条件都得到满足。这里,允许出现前导零。

例如,假设约束条件为 $P = NP$。那么,满足此约束的解集是所有满足 $N = 0$ 的赋值。另一个例子是约束 $2000CNY > 3000USD$。在这里,没有任何赋值可以满足此约束,因为 $2000CNY$ 是一个小于 $3 \times 10^6$ 的 $7$ 位十进制整数,而 $3000USD$ 是一个大于或等于 $3 \times 10^6$ 的 $7$ 位十进制整数。

现在 Bobo 收到了 $n$ 个约束条件,他想知道有多少种为 $26$ 个大写英文字母分配 $0-9$ 的方案,使得所有约束条件都得到满足。由于答案可能非常大,你需要输出答案对 $998\,244\,353$(一个质数)取模后的结果。

输入格式

第一行包含一个整数 $n$ ($0 \le n \le 10$),表示约束条件的数量。

接下来 $n$ 行,每行包含一个形如 $X \ op \ Y$ 的约束条件,其中 $X$ 和 $Y$ 是由数字 $0$ 到 $9$ 和大写英文字母组成的字符串,$op \in \{<, >, =\}$。

保证所有约束条件的长度之和不超过 $50$。

输出格式

输出一行一个整数,表示满足给定约束系统方案的数量,对 $998\,244\,353$ 取模。

样例

输入 1

1
P=NP

输出 1

766136394

输入 2

1
2000CNY>3000USD

输出 2

0

输入 3

4
AB>CD
E<A
BC>FF
EF>F1

输出 3

23645065

说明

正如题目中所讨论的,约束 $P = NP$ 有 $10^{25}$ 个解,对 $998\,244\,353$ 取模后为 $766136394$;而 $2000CNY > 3000USD$ 有 $0$ 个解。

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.