QOJ.ac

QOJ

Limite de temps : 0.5 s Limite de mémoire : 512 MB Points totaux : 100

#782. 大过滤器

Statistiques

题目背景

大过滤器理论(The Great Filter)认为,文明在发展过程中存在若干个重要的划分阶段,各阶段之间存在着极难跨越的沟壑,以至于达到最终可以实现星际殖民阶段的文明少之又少。这一理论也被认为是费米悖论的一种解释。

题目描述

在本题中,我们认为文明存在 $n$ 个级别,而这 $n$ 个级别又被划分为 $k$ 个阶段。具体地,我们有数组 $L_0, L_1, \dots, L_k$,满足 $0 = L_0 < L_1 < \dots < L_k = n$,其中第 $L_{j-1} + 1$ 到第 $L_j$ 个文明级别被认为是处于阶段 $j$ 的。

我们认为一张有向图 $G = (V, E)$ 刻画了文明可以通过什么手段达到最终级别。若 $(x, y) \in E$,则说明处于 $x$ 级别的文明可以尝试进步到 $y$ 级别(注意这里并不保证 $x < y$!)。特别地,由于大过滤器的存在,设 $x$ 是 $j$ 阶段的文明,那么 $y$ 只可能处于 $j$ 阶段或者 $j + 1$ 阶段。如果 $y$ 也属于 $j$ 阶段,那么我们认为这是一次“常规进步”,否则 $y$ 属于 $j + 1$ 阶段,我们认为这是一次“危险进步”。

我们认为现在人类文明所处的级别为 $1$ 级别,我们的目标是达到 $i$ 级别,我们需要规划一个进步方案。方案可以表示为 $1$ 到 $n$ 的一条路径,我们如此定义一种方案的困难程度:设计数器初始有 $s = 0$,我们按顺序考虑这条路径,每次发生一次“常规进步”,那么 $s \leftarrow s + 1$,每次发生一次“危险进步”,那么 $s \leftarrow s \times 2$;最后的 $s$ 值就是该进步方案的困难程度。

对于每个 $1 \le i \le n$,请你判断是否存在一种从 $1$ 级别进步至 $i$ 级别的方案,如果存在,那么请规划一种方案使得困难程度最小。

输入格式

从文件 filter.in 中读入数据。

第一行输入三个正整数 $n, m, k$,表示文明的级别数量,图的边数,以及文明的阶段数。

接下来一行输入 $k - 1$ 个正整数,表示 $L_1, \dots, L_{k-1}$,如题意所示。

接下来 $m$ 行每行输入两个正整数 $x, y$ 表示一条边。

输出格式

输出到文件 filter.out 中。

输出共 $n$ 行,第 $i$ 行一个整数,表示从 $1$ 级别进化到 $i$ 级别的最小困难程度。由于这个数很大,你只需要输出其 $\text{mod } 998244353$ 的结果即可。如果无法进化到 $i$ 级别,输出 $-1$。

样例

样例 1 输入

6 6 2
3
1 2
2 3
3 4
4 5
5 6
2 6

样例 1 输出

0
1
2
4
5
2

样例 2

见选手目录下的 filter/filter2.infilter/filter2.ans

样例 2 解释

注意取模。

样例 3

见选手目录下的 filter/filter3.infilter/filter3.ans

子任务

对于 100% 的数据,保证 $2 \le k \le n \le 3 \times 10^5$,$1 \le m \le 5 \times 10^5$,$1 \le x, y \le n$。

测试点 分值 $n \le$ $m \le$ $k \le$
1 10 $10^2$ $200$ $n$
2 15 $10^5$ $2 \times 10^5$ $40$
3 10 $3 \times 10^5$ $5 \times 10^5$ $n$
4 20 $500$ $10^3$ $n$
5 20 $3 \times 10^4$ $6 \times 10^4$ $n$
6 15 $10^5$ $2 \times 10^5$ $n$
7 10 $3 \times 10^5$ $5 \times 10^5$ $n$

提示

本题输入文件在 10 MB 以内,输出文件在 5 MB 以内,请使用较快的输入输出方式。

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.