Logo
(追記) (追記ここまで)

33425번 - Junctions 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB54480.000%

문제

The streets and junctions of the Martian City can be represented as a weighted bidirectional complete graph where the $n$ 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 $(a, b),ドル determine whether there exists a pair of vertices $(x, y)$ such that all shortest paths from $x$ to $y$ pass through the edge $(a, b)$.

입력

The first line contains a positive integer $n$ (1ドル \le n \le 500$) representing the number of junctions in the city.

Each of the next $n$ lines contains $n$ space-separated integers. Together, they form an $n \times n$ matrix. The number $a_{i, j}$ (1ドル \leq a_{i, j} \leq 10^6$) in the $i$-th row and $j$-th column represents the length of the bidirectional street between junctions $i$ and $j$. Specifically, $a_{i, i} = 0$ and $a_{i, j} = a_{j, i}$.

출력

Output a binary matrix of size $n \times n$ without spaces. The entry in the $i$-th row and $j$-th column must be 1ドル$ if the edge $(i, j)$ satisfies the conditions described in the problem, and 0ドル$ otherwise.

In particular, output 0ドル$ when $i = j$.

제한

예제 입력 1

4
0 3 2 100
3 0 8 100
2 8 0 10
100 100 10 0

예제 출력 1

0110
1000
1001
0010

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2024 > Day 2: CCPC Contest 1 J번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /