QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#7995. 图

الإحصائيات

题目描述

给定一个 $n$ 个点的无向正权完全图,请对于每一条边 $(a,b)$,求出是否存在一个点对 $(x,y)$ 使得 $x\rightarrow y$ 的所有最短路都经过 $(a,b)$。

输入格式

从标准输入读入数据。

第一行一个正整数 $n (1 \le n \le 500)$ 表示图的点数。

接下来 $n$ 行每行 $n$ 个数,构成一个大小为 $n\times n$ 的矩阵,第 $i$ 行第 $j$ 个数 $a_{i,j}(1\leq a_{i,j}\leq 10^6)$ 表示 $(i,j)$ 之间的边长度,特别地,$a_{i,i} = 0$.

保证 $a_{i,j}=a_{j,i}$。

输出格式

输出到标准输出。

输出一个大小为 $n$ 的 $01$ 矩阵,其中第 $i$ 行第 $j$ 列为 $1$ 表示边 $(i,j)$ 满足题目中提出的要求,$0$ 表示不满足。

特别的,当 $i=j$ 时输出 $0$。

样例

输入

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

输出

0110
1000
1001
0010
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.