Submission #2861137
Source Code Expand
#include <stdio.h> #define MAX_INT (-1U>>1) #define MAX(x, y) ((x)>(y)?(x):(y)) #define MIN(x, y) ((x)>(y)?(y):(x)) int n, m; int bus[300][300]; int visited[300]; int ge(int from, int to) { visited[from] = 1; if (bus[from][to] != MAX_INT) return bus[from][to]; int min = MAX_INT; for (int i = 0; i < n; i++) { if (visited[i] || bus[from][i] == MAX_INT) continue; min = MIN(min, bus[from][i] + ge(i, to)); } bus[from][to] = min; bus[to][from] = min; return min; } int main() { int a, b, i, j, k, t, min = MAX_INT, res[300], tmp; scanf("%d%d", &n, &m); for (i = 0; i < n; i++) { for (j = 0; j < n; j++) bus[i][j] = MAX_INT; bus[i][i] = 0; } for (i = 0; i < m; i++) { scanf("%d%d%d", &a, &b, &t); bus[a - 1][b - 1] = t; bus[b - 1][a - 1] = t; } for (i = 0; i < n; i++) for (j = 0; j < n; j++) { ge(i, j); for(k = 0; k < n; k++) visited[k] = 0; } for (i = 0; i < n; i++) { for (j = 0; j < n; j++) tmp = MAX(tmp, bus[i][j]); min = MIN(tmp, min); tmp = 0; } printf("%d\n", min); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - バスと避けられない運命 |
User | Bookends |
Language | C (Clang 3.8.0) |
Score | 0 |
Code Size | 1210 Byte |
Status | WA |
Exec Time | 46 ms |
Memory | 512 KB |
Judge Result
Set Name | All | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 100 | ||||
Status |
|
Set Name | Test Cases |
---|---|
All | sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1 ms | 128 KB |
sample_02.txt | AC | 1 ms | 128 KB |
sample_03.txt | AC | 1 ms | 128 KB |
test_01.txt | AC | 1 ms | 128 KB |
test_02.txt | WA | 46 ms | 512 KB |
test_03.txt | WA | 13 ms | 512 KB |
test_04.txt | WA | 8 ms | 384 KB |
test_05.txt | WA | 6 ms | 384 KB |
test_06.txt | WA | 1 ms | 256 KB |
test_07.txt | WA | 10 ms | 512 KB |
test_08.txt | WA | 1 ms | 256 KB |
test_09.txt | WA | 4 ms | 384 KB |
test_10.txt | WA | 1 ms | 256 KB |
test_11.txt | WA | 1 ms | 256 KB |
test_12.txt | WA | 10 ms | 512 KB |
test_13.txt | WA | 1 ms | 256 KB |
test_14.txt | WA | 2 ms | 256 KB |
test_15.txt | WA | 10 ms | 512 KB |
test_16.txt | WA | 2 ms | 256 KB |
test_17.txt | WA | 5 ms | 384 KB |
test_18.txt | WA | 9 ms | 512 KB |
test_19.txt | WA | 2 ms | 256 KB |
test_20.txt | WA | 2 ms | 256 KB |
test_21.txt | WA | 1 ms | 128 KB |
test_22.txt | WA | 4 ms | 384 KB |
test_23.txt | WA | 1 ms | 256 KB |
test_24.txt | WA | 35 ms | 512 KB |
test_25.txt | WA | 34 ms | 512 KB |
test_26.txt | WA | 9 ms | 384 KB |
test_27.txt | WA | 11 ms | 384 KB |
test_28.txt | WA | 35 ms | 512 KB |
test_29.txt | WA | 35 ms | 512 KB |
test_30.txt | WA | 2 ms | 256 KB |
test_31.txt | WA | 1 ms | 256 KB |
test_32.txt | WA | 34 ms | 512 KB |
test_33.txt | WA | 35 ms | 512 KB |
test_34.txt | WA | 1 ms | 256 KB |
test_35.txt | WA | 7 ms | 384 KB |
test_36.txt | WA | 34 ms | 512 KB |