QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#414171#7995. 图AcetaminophenWA 2ms6628kbC++111.2kb2024-05-18 16:15:002024-05-18 16:15:00

Judging History

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

  • [2024-05-18 16:15:00]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:6628kb
  • [2024-05-18 16:15:00]
  • 提交

answer

#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 505; // 假设最大节点数为105
int dist[N][N]; // 存储两点间最短距离
int s[N][N];
int ans[N][N];
void init() {
    memset(dist, 0x3f, sizeof(dist)); // 将dist数组初始化为一个很大的数
    for (int i = 1; i < N; i++) {
        dist[i][i] = 0; // 自己到自己距离为0
    }
    for(int i = 1; i <= N; i++)
    {
        for(int j = 1; j <= N; j++)
            ans[i][j] = 1;
    }
}
int main() {
    int n;
    cin >> n;
    init();
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            int x;
            cin>>x;
            s[i][j]=x;
            dist[i][j] = min(dist[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(dist[i][j] <= dist[i][k] + dist[k][j] && (k !=i || k !=j))
                    ans[i][j] = 0;
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            cout << ans[i][j];
        }
        cout << endl;
    }
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 6628kb

input:

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

output:

0000
0000
0000
0000

result:

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