QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#301806#7995. 图PhantomThreshold#WA 1ms3476kbC++201.0kb2024-01-10 12:01:262024-01-10 12:01:28

Judging History

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

  • [2024-01-10 12:01:28]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3476kb
  • [2024-01-10 12:01:26]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<vector<int>> w(n+5,vector<int>(n+5)),d(n+5,vector<int>(n+5)),c(n+5,vector<int>(n+5));
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			cin>>w[i][j],d[i][j]=w[i][j],c[i][j]=1;
	for(int i=1;i<=n;i++)
		c[i][i]=1,d[i][i]=0;
	for(int k=1;k<=n;k++)
		for(int i=1;i<=n;i++) if(i!=k)
			for(int j=1;j<=n;j++) if(j!=k && j!=i)
			{
				if(d[i][j]>d[i][k]+d[k][j])
				{
					d[i][j]=d[i][k]+d[k][j];
					c[i][j]=c[i][k]*c[k][j];
					c[i][j]=min(c[i][j],2);
				}
				else if(d[i][j]==d[i][k]+d[k][j])
				{
					c[i][j]+=c[i][k]*c[k][j];
					c[i][j]=min(c[i][j],2);
				}
			}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		{
//			cerr<<d[i][j]<<" \n"[j==n];
//			cout<<(c[i][j]==1 and d[i][j]==w[i][j])<<" \n"[j==n];
		}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		{
//			cerr<<c[i][j]<<" \n"[j==n];
			cout<<(c[i][j]==1 and d[i][j]==w[i][j] and i!=j)<<" \n"[j==n];
		}
	return 0;
}

详细

Test #1:

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

input:

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

output:

0 1 1 0
1 0 0 0
1 0 0 1
0 0 1 0

result:

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