I do not know Graph Theory!

TimeLimit:14000MS  MemoryLimit:524288KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
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.
Input
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$.
Output
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.
SampleInput
2
3
0
2
6
1
3
7
F
F1
SampleOutput
1
0
0
0
0
0
10
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: