QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#377425 | #7995. 图 | plutos | WA | 0ms | 5708kb | C++17 | 1.2kb | 2024-04-05 13:29:14 | 2024-04-05 13:29:16 |
Judging History
answer
#include <bits/stdc++.h>
void Yes() {
std::cout << "YES" << "\n";
return;
}
void No() {
std::cout << "NO" << "\n";
return;
}
template<typename T>
void out(T x) { std::cout << x << "\n"; }
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
const ll N = 2e5 + 10;
ll dp[505][505];
ll ans[505][505];
void Solve() {
ll n;
cin >> n;
for (ll i = 1; i <= n; i++) {
for (ll j = 1; j <= n; j++) {
cin >> dp[i][j], ans[i][j] = 1;
if(i == j)
ans[i][j] = 0;
}
}
for (ll k = 1; k <= n; k++) {
for (ll i = 1; i <= n; i++) {
for (ll j = 1; j <= n; j++)
{
if (dp[i][k] + dp[k][j] <= dp[i][j]) {
ans[i][j] = ans[j][i] = 0;
dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
}
}
}
}
for (ll i = 1; i <= n; i++) {
for (ll j = 1; j <= n; j++) {
cout<<ans[i][j];
}
cout<<"\n";
}
}
signed main() {
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll t = 1;
// cin>>t;
while (t--)
Solve();
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 5708kb
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'