#P10048. [CCPC 2023 北京市赛] 图
[CCPC 2023 北京市赛] 图
Problem Description
Given an undirected complete graph with vertices and positive edge weights, for each edge , determine whether there exists a pair of vertices such that all shortest paths from to pass through .
Input Format
The first line contains a positive integer , representing the number of vertices in the graph.
The next lines each contain numbers, forming an matrix. The number in row and column represents the length of the edge between . In particular, .
It is guaranteed that .
Output Format
Output a matrix of size . The value in row and column is if the edge satisfies the requirement stated in the problem, and otherwise.
In particular, output when .
4
0 3 2 100
3 0 8 100
2 8 0 10
100 100 10 0
0110
1000
1001
0010
Hint
Translated by ChatGPT 5