QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#377385 | #7995. 图 | ling | WA | 0ms | 5780kb | C++17 | 2.0kb | 2024-04-05 13:00:14 | 2024-04-05 13:00:15 |
Judging History
answer
//(ᗜ ˰ ᗜ)
// #define NDEBUG
#include <bits/stdc++.h>
using namespace std;
namespace LING
{
#ifdef ONLINE_JUDGE
#define DBG(...) ;
#define dbg(...) ;
#else
#define DBG(x) cout << "! " << #x << " = " << x << endl
#include "debug.h"
#endif
using ll = long long;
using db = double;
#define SPO(x) fixed << setprecision(x)
#define FOR(i, l, r) for (ll i = l; i <= (r); ++i)
#define ROF(i, r, l) for (ll i = r; i >= (l); --i)
#define edl '\n'
#define fir first
#define sec second
#define str string
#define pll pair<ll, ll>
#define heap priority_queue
// constexpr db PI = acos(-1.0);
// constexpr db EPS = 1.0e-9;
constexpr long long LNF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int INF = 0x3f3f3f3f;
constexpr long long MOD = 998244353;
constexpr ll MXN = 5e2 + 5;
ll KSM(ll base, ll exp, ll MOD)
{
ll res = 1;
base %= MOD;
while (exp)
{
if (exp & 1)
res = (res * base) % MOD;
base = (base * base) % MOD;
exp >>= 1;
}
return res;
}
}
using namespace LING;
ll n;
ll a[MXN][MXN];
ll f[MXN][MXN];
void Solve(void)
{
cin >> n;
FOR(i, 1, n)
FOR(j, 1, n)
{
if (i != j)
f[i][j] = LNF;
}
FOR(i, 1, n)
FOR(j, 1, n)
{
cin >> a[i][j];
a[i][j] += 1e9;
f[i][j] = min(f[i][j], a[i][j]);
}
FOR(k, 1, n)
FOR(i, 1, n)
FOR(j, 1, n)
f[i][j] = min(f[i][j], f[i][k] + f[k][j]);
FOR(i, 1, n)
{
FOR(j, 1, n)
{
if (i != j && a[i][j] == f[i][j])
cout << 1;
else
cout << 0;
}
cout << edl;
}
return;
}
int main(void)
{
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
// #ifndef ONLINE_JUDGE
// freopen("cin.txt","r",stdin);
// freopen("cout.txt","w",stdout);
// #endif
int t = 1;
// cin >> t;
while (t--)
Solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 5780kb
input:
4 0 3 2 100 3 0 8 100 2 8 0 10 100 100 10 0
output:
0111 1011 1101 1110
result:
wrong answer 1st lines differ - expected: '0110', found: '0111'