QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#377425#7995. 图plutosWA 0ms5708kbC++171.2kb2024-04-05 13:29:142024-04-05 13:29:16

Judging History

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

  • [2024-04-05 13:29:16]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:5708kb
  • [2024-04-05 13:29:14]
  • 提交

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();
}

Details

Tip: Click on the bar to expand more detailed information

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'