# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
728028 | 2023-04-21T20:23:43 Z | rainboy | 컴퓨터 네트워크 (BOI14_network) | C++17 | 109 ms | 7984 KB |
#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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 102 ms | 7816 KB | Output is correct |
2 | Correct | 107 ms | 7404 KB | Output is correct |
3 | Correct | 95 ms | 6980 KB | Output is correct |
4 | Correct | 92 ms | 6976 KB | Output is correct |
5 | Correct | 87 ms | 6700 KB | Output is correct |
6 | Correct | 92 ms | 6620 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 428 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 95 ms | 6672 KB | Output is correct |
2 | Correct | 26 ms | 2812 KB | Output is correct |
3 | Correct | 103 ms | 7816 KB | Output is correct |
4 | Correct | 104 ms | 6196 KB | Output is correct |
5 | Correct | 97 ms | 7984 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 107 ms | 6608 KB | Output is correct |
2 | Correct | 24 ms | 2816 KB | Output is correct |
3 | Correct | 109 ms | 7756 KB | Output is correct |
4 | Correct | 90 ms | 6120 KB | Output is correct |
5 | Correct | 92 ms | 7916 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 103 ms | 6636 KB | Output is correct |
2 | Correct | 24 ms | 2768 KB | Output is correct |
3 | Correct | 98 ms | 7808 KB | Output is correct |
4 | Correct | 88 ms | 6220 KB | Output is correct |
5 | Correct | 100 ms | 7848 KB | Output is correct |