Submission #728028

#TimeUsernameProblemLanguageResultExecution timeMemory
728028rainboyComputer Network (BOI14_network)C++17
100 / 100
109 ms7984 KiB
#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)

grader.c: In function 'int main()':
grader.c:48:11: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   48 |     scanf ("%d%d%d%d", &N, &a, &b, &M);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
grader.c:51:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   51 |             scanf("%d", &distance[u][v]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...