QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#401544#7995. 图DoqeWA 1ms3704kbC++14459b2024-04-28 22:02:102024-04-28 22:02:10

Judging History

你现在查看的是最新测评结果

  • [2024-04-28 22:02:10]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3704kb
  • [2024-04-28 22:02:10]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N=505;
int a[N][N];
int main()
{
	int n;cin>>n;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j)
			cin>>a[i][j];
	for(int k=1;k<=n;++k)for(int i=1;i<=n;++i)for(int j=1;j<=n;++j)a[i][j]=min(a[i][j],a[i][k]+a[k][j]);
	for(int i=1;i<=n;++i,puts(""))for(int j=1;j<=n;++j)
	{
		int op=1;
		for(int k=1;k<=n;++k)if(k!=i&&k!=j&&a[i][j]==a[i][k]+a[k][j])op=0;
		putchar('0'+op);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3704kb

input:

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

output:

1110
1100
1011
0011

result:

wrong answer 1st lines differ - expected: '0110', found: '1110'