Junctions
시간 제한2초메모리 제한2048 MB
완전 가중 그래프가 인접 행렬로 주어질 때, 어떤 두 정점 사이의 모든 최단 경로가 반드시 지나는 간선 (i,j)를 찾아 표시한다.
문제
The streets and junctions of the Martian City can be represented as a weighted bidirectional complete graph where the junctions are the vertices and the streets are the edges. The weight of an edge is the length of the corresponding street.
For each edge , determine whether there exists a pair of vertices such that all shortest paths from to pass through the edge .
입력
The first line contains a positive integer () representing the number of junctions in the city.
Each of the next lines contains space-separated integers. Together, they form an matrix. The number () in the -th row and -th column represents the length of the bidirectional street between junctions and . Specifically, and .
출력
Output a binary matrix of size without spaces. The entry in the -th row and -th column must be if the edge satisfies the conditions described in the problem, and otherwise.
In particular, output when .