QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#410166#7995. 图EDGEWA 0ms3904kbC++14944b2024-05-13 17:27:282024-05-13 17:27:29

Judging History

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

  • [2024-05-13 17:27:29]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3904kb
  • [2024-05-13 17:27:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair(x,y)
#define p first
#define v second
const int maxn=5e2+10;
const int maxm = 1e6+10;
int n,x,y;
int dis[maxn][maxn],diss[maxn][maxn];
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++){
        scanf("%d",&x);
        diss[i][j]=dis[i][j]=x;
    }
    for(int k=1;k<=n;k++)
        for(int i=1;i<=n;i++)
            for(int j=1;j<=n;j++){
                if(dis[i][j]>dis[i][k]+dis[k][j]){
                    dis[i][j]=dis[i][k]+dis[k][j];
                }
            }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(i==j)
                printf("0 ");
            else if(dis[i][j]==diss[i][j])
                printf("1 ");
            else
                printf("0 ");
        }
        puts("");
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3904kb

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 '