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

建议使用的浏览器:

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

6884:I do not know Graph Theory!

题目描述
A tournament graph is a directed graph where there is exactly one edge between every two distinct vertices.

A strongly connected graph is a directed graph where there is a path between every two distinct vertices.

You are given a tournament graph. For each edge of the graph, find out whether the graph is strongly connected when that edge is reversed.
输入解释
The first line contains one integer $T$ ($1 \leq T \leq 40000$), the number of test cases.

For each test case, the first line contains one integer $n$ ($2 \leq n \leq 5000$), the number of vertices.

The next $n-1$ lines give out the compressed lower triangular matrix in the following way:

Each line contains an uppercase hexadecimal string, where the $j$-th hexadecimal of the $i$-th string $S_{i,j}=\sum_{k=0}^{3}{2^k \times E_{i+1,4j+k-3}}$, and $E_{i,j}=1$ iff the direction of the edge between $i,j$ is from $i$ to $j$. All indices start from $1$.

It is guaranteed that there are at most $3$ test cases in which the $n$ is larger than $10$.
输出解释
For each test case, output $n-1$ lines in the same format of the input: $S_{i,j}=\sum_{k=0}^{3}{2^k \times ans_{i+1,4j+k-3}}$, and $ans_{i,j}=1$ iff the graph is strongly connected when the edge between $i,j$ is reversed.
输入样例
2
3
0
2
6
1
3
7
F
F1
输出样例
1
0
0
0
0
0
10
来自杭电HDUOJ的附加信息
Recommend IceyWang

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

源链接: HDU-6884

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

共提交 0

通过率 --%
时间上限 内存上限
28000/14000MS(Java/Others) 524288/524288K(Java/Others)