QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#377354 | #7995. 图 | ling | WA | 2ms | 6136kb | C++17 | 2.0kb | 2024-04-05 12:47:56 | 2024-04-05 12:47:57 |
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];
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: 100
Accepted
time: 1ms
memory: 5644kb
input:
4 0 3 2 100 3 0 8 100 2 8 0 10 100 100 10 0
output:
0110 1000 1001 0010
result:
ok 4 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 5692kb
input:
4 0 3 2 100 3 0 8 100 2 8 0 10 100 100 10 0
output:
0110 1000 1001 0010
result:
ok 4 lines
Test #3:
score: -100
Wrong Answer
time: 2ms
memory: 6136kb
input:
100 0 41659 61282 49636 67326 48035 29694 46438 87384 82143 38685 66540 48746 29800 91786 54931 56232 61941 53423 75707 45135 69244 53802 89998 64199 63778 75825 31745 66975 44537 35793 55663 72647 60768 80884 46657 54066 84568 6266 48213 78216 50369 66761 54861 67607 38509 52250 54210 71135 56840 5...
output:
0001000000000000000000000000000000000010010100000000100001001100101000000001000000000000000000010010 0011000000100000000001000000100000000000000000000000000000100000000001001000000001000000010000000100 01001000011000000000000000001000000000000000000000001000001011000010010010000000010000000100000001...
result:
wrong answer 1st lines differ - expected: '000000000000000000000000000000...0000001000000000000000000000010', found: '000100000000000000000000000000...0000001000000000000000000010010'