Submission #944492

#TimeUsernameProblemLanguageResultExecution timeMemory
944492rainboy탐사 (KOI13_probe)C11
19 / 19
1 ms428 KiB
#include <stdio.h> #include <string.h> #define N 40 #define K 1000 #define M ((N + K) * 2) int main() { static int dd[N + 1], dd_[N + 1], ii[M], jj[M], ww[M]; static char cc[N + 1]; int n, k, m, h, i, j, w, d; scanf("%d%d", &n, &k); m = 0; for (i = 0; i < n; i++) { ii[m] = i, jj[m] = i + 1, ww[m] = 1, m++; ii[m] = i + 1, jj[m] = i, ww[m] = 0, m++; } while (k--) { scanf("%d%d%d", &i, &j, &w), i--; ii[m] = i, jj[m] = j, ww[m] = w, m++; ii[m] = j, jj[m] = i, ww[m] = -w, m++; } for (k = 0; k <= n + 1; k++) { memcpy(dd_, dd, (n + 1) * sizeof *dd); for (h = 0; h < m; h++) { i = ii[h], j = jj[h], w = ww[h], d = dd[i] + w; if (dd[j] > d) { dd[j] = d; if (k == n) { printf("NONE\n"); return 0; } } } } for (i = 0; i < n; i++) cc[i] = dd[i + 1] == dd[i] ? '-' : '#'; printf("%s\n", cc); return 0; }

Compilation message (stderr)

probe.c: In function 'main':
probe.c:13:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%d%d", &n, &k);
      |  ^~~~~~~~~~~~~~~~~~~~~
probe.c:20:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |   scanf("%d%d%d", &i, &j, &w), i--;
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...