QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#301806 | #7995. 图 | PhantomThreshold# | WA | 1ms | 3476kb | C++20 | 1.0kb | 2024-01-10 12:01:26 | 2024-01-10 12:01:28 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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'