| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 728028 | rainboy | Computer Network (BOI14_network) | C++17 | 109 ms | 7984 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "network.h"
#define N	1000
unsigned int X = 12345;
int rand_() {
	return (X *= 3) >> 1;
}
int ii[N], dd[N];
void sort(int *ii, int l, int r) {
	while (l < r) {
		int i = l, j = l, k = r, i_ = ii[l + rand_() % (r - l)], tmp;
		while (j < k)
			if (dd[ii[j]] == dd[i_])
				j++;
			else if (dd[ii[j]] < dd[i_]) {
				tmp = ii[i], ii[i] = ii[j], ii[j] = tmp;
				i++, j++;
			} else {
				k--;
				tmp = ii[j], ii[j] = ii[k], ii[k] = tmp;
			}
		sort(ii, l, i);
		l = k;
	}
}
void findRoute(int n, int s, int t) {
	int h, i;
	s--, t--;
	for (i = 0; i < n; i++)
		dd[i] = i == t ? 0 : ping(i + 1, t + 1) + 1;
	for (i = 0; i < n; i++)
		ii[i] = i;
	sort(ii, 0, n);
	for (h = n - 1; h >= 0; h--) {
		i = ii[h];
		if (dd[i] == dd[s] - 1 && ping(s + 1, i + 1) == 0)
			travelTo((s = i) + 1);
	}
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
