当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6891:Chess Class

题目描述
This class is on chess. Baby Volcano is playing a special chess game with his friend, Baby Evil.

In this chess game, there is a directed graph $G = (V,E)$. Vertices are indexed from $1$ to $n$. It is guaranteed that every vertex has at least one out-going edge, i.e. $\forall v\in V, \exists w\in V, (v,w)\in E$, Baby Volcano takes control of a subset of vertices $X\subseteq V$, Baby Evil takes control of $V\setminus X$. Every vertex $v$ is assigned a weight $W(v)$.

There is a chess, positioning at $s\in V$ initially. The game consists of three phases.

1. For every $p\in X$, Baby Volcano chooses an out-going edge $(p,q)\in E$ and delete other out-going edges of vertex $p$.

2. After Volcano's operation, Baby Evil would similarly choose an out-going edge $(p',q')\in E$ and delete other out-going edges of $p'$ for every $p' \notin X$. Both two babies make decisions based on chess's initial position $s$.

3. After two processes above, every vertex would remain only one out-going edge. The chess starts moving along the unique path in the processed graph, resulting in an infinite path $L = v_0v_1v_2\cdots$, where $v_0=s$. Baby Volcano gains score $CV$ at last, which is computed below:
$$CV:= \max\left\{W\left(v_i\right) \ |\ v_i \text{ appears in }L\right\}$$

Baby Volcano wants to maximize $CV$, while Baby Evil wants to minimize it.

Your task is to determine, for every $s,1\leq s\leq n$, compute $CV$ under the circumstance that the chess is put at $s$ initially.
输入解释
In the first line there is a number $T$, denotes the number of test cases.

Then there are $T$ parts of input, each part describes a test case. Each parts begins with $n,m,R,B$, denotes the number of vertices, edges, the range of $W(v)$, and the size of $X$, the set which baby volcano takes control.

Then there is a line consists of $B$ numbers, denotes elements in $X$.

Then there is a line with $n$ numbers, the $i$-th number, denotes $W(i), 1\leq W(i)\leq R$.

Then there are $m$ lines, each line consists of $2$ numbers, $u,v$, showing that there is an edge from $u$ to $v$ in $G$.

$1\leq T\leq 100$

$1\leq m,R\leq 5\times 10^5$

$1\leq B\leq n\leq 5\times 10^5$

$1\leq \sum{n},\sum{m},\sum{R}\leq 10^6$
输出解释
For each test case, you should first output ''Case #t:''(without quotes), denotes the test number.

Then you need to output $n$ numbers in the next line, the $i$-th number is $CV$ under the circumstance that the chess is put at $i$ initially.
输入样例
2
3 3 2 1
3
1 1 2
1 2
2 3
3 3
4 6 10 1
4
8 7 3 2
1 3
2 4
3 2
4 2
2 1
2 2
输出样例
Case #1:
2 2 2
Case #2:
8 7 7 7
来自杭电HDUOJ的附加信息
Recommend IceyWang

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6891

最后修改于 2020-10-25T23:35:18+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000/2000MS(Java/Others) 262144/262144K(Java/Others)