QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#414171 | #7995. 图 | Acetaminophen | WA | 2ms | 6628kb | C++11 | 1.2kb | 2024-05-18 16:15:00 | 2024-05-18 16:15:00 |
Judging History
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'