QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#389437#7995. 图O_start#WA 4ms10612kbC++142.1kb2024-04-14 13:24:572024-04-14 13:24:57

Judging History

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

  • [2024-04-14 13:24:57]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:10612kb
  • [2024-04-14 13:24:57]
  • 提交

answer

#pragma oucGCC optimize(2)
#include<iostream>
#include<queue>
#include<cmath>
#include<vector>
#include<queue>
#include<cstring>
#include<algorithm>
#include<set>
#include<unordered_set>
#include<stack>
#include<map>
#include<unordered_map>
using namespace std;
long long  k, p, q, m, n;
const int maxn = 200005;
const long long inf = 0xfffffffffffff;
const int mod = 1e9 + 7;
int t;
string s;
struct Node {
	int x;
	int y;
};
bool cmp(Node a, Node b) {
	return a.x > b.x;
}
long long a[maxn];
vector<int>g[maxn];
long long cnt[maxn];
long long fact[maxn], infact[maxn];
long long qpow(long long a, long long b) {
	if (b < 0) return 0;
	long long ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = (ans * a) % mod;
		b >>= 1;
		a = (a * a) % mod;
	}
	return ans;
}
void init() {
	fact[0] = 1, infact[0] = 1;
	for (int i = 1; i < maxn; i++) {
		fact[i] = i * fact[i - 1] % mod;
		infact[i] = infact[i - 1] % mod * qpow(i, mod - 2) % mod;
	}
}
long long inv(long long n) {
	return qpow(n, mod - 2);
}
long long frac_mod(long long a, long long b) {
	return (a * inv(b) % mod) % mod;
}
long long nCr(long long n, long long r) {
	if (r > n || r < 0)
		return 0;
	if (n == r)
		return 1;
	if (r == 0)
		return 1;
	return (fact[n] * infact[r]) % mod * infact[n - r] % mod;
}
long long gcd(long long da, long long xiao) {
	while (xiao != 0) {
		long long temp = xiao;
		xiao = da % xiao;
		da = temp;
	}
	return(da);
}
long long dis[505][505];
long long d[505][505];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			cin >> d[i][j];
			dis[i][j] = d[i][j];
		}
	}
	for (int k = 1; k <= n; k++) {
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				if (d[i][k] < inf && d[k][j] < inf)
					d[i][j] = min(d[i][k] + d[k][j], d[i][j]);
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (i == j) {
				cout << "0";
			}
			else {
				if (d[i][j] == dis[i][j])cout << "1";
				else cout << "0";
			}
		}
		cout << '\n';
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 8904kb

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: 2ms
memory: 9636kb

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: 4ms
memory: 10612kb

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'