結果
問題 | No.1814 Uribo Road (Easy) |
ユーザー | Shirotsume |
提出日時 | 2021-11-04 22:14:48 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,305 bytes |
コンパイル時間 | 689 ms |
コンパイル使用メモリ | 81,664 KB |
実行使用メモリ | 79,360 KB |
最終ジャッジ日時 | 2024-11-21 22:56:37 |
合計ジャッジ時間 | 7,985 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 47 ms
52,096 KB |
testcase_01 | AC | 55 ms
61,312 KB |
testcase_02 | AC | 42 ms
51,840 KB |
testcase_03 | AC | 42 ms
51,712 KB |
testcase_04 | AC | 42 ms
51,840 KB |
testcase_05 | AC | 42 ms
52,096 KB |
testcase_06 | AC | 50 ms
60,160 KB |
testcase_07 | AC | 43 ms
52,224 KB |
testcase_08 | AC | 41 ms
52,480 KB |
testcase_09 | AC | 71 ms
66,816 KB |
testcase_10 | AC | 65 ms
64,256 KB |
testcase_11 | AC | 103 ms
76,288 KB |
testcase_12 | AC | 120 ms
76,800 KB |
testcase_13 | AC | 109 ms
76,416 KB |
testcase_14 | AC | 118 ms
76,928 KB |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | AC | 202 ms
68,864 KB |
testcase_19 | AC | 206 ms
69,120 KB |
testcase_20 | AC | 184 ms
77,184 KB |
testcase_21 | RE | - |
testcase_22 | AC | 188 ms
78,464 KB |
testcase_23 | WA | - |
testcase_24 | AC | 215 ms
79,232 KB |
testcase_25 | AC | 209 ms
78,848 KB |
testcase_26 | AC | 199 ms
78,592 KB |
testcase_27 | AC | 209 ms
79,232 KB |
testcase_28 | AC | 212 ms
79,104 KB |
testcase_29 | AC | 211 ms
79,104 KB |
testcase_30 | AC | 204 ms
79,104 KB |
testcase_31 | AC | 205 ms
79,360 KB |
testcase_32 | AC | 113 ms
76,928 KB |
testcase_33 | AC | 70 ms
65,280 KB |
testcase_34 | AC | 61 ms
62,848 KB |
testcase_35 | AC | 119 ms
76,416 KB |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | AC | 150 ms
77,568 KB |
testcase_39 | AC | 107 ms
76,672 KB |
testcase_40 | AC | 134 ms
77,824 KB |
testcase_41 | AC | 216 ms
78,848 KB |
testcase_42 | AC | 177 ms
77,440 KB |
testcase_43 | AC | 110 ms
76,544 KB |
testcase_44 | AC | 125 ms
77,056 KB |
testcase_45 | AC | 105 ms
76,544 KB |
testcase_46 | AC | 212 ms
79,104 KB |
ソースコード
#嘘 INF = 10 ** 18 N, M, K = map(int,input().split()) assert (1 <= N <= 200 and K <= 5 and 1 <= K <= M <= N * (N - 1) // 2) dist = [[0 if i == j else INF for i in range(N)] for j in range(N)] R = list(map(int,input().split())) points = [] nes_cost = 0 check_set = set() for i in range(M): A, B, C = map(int,input().split()) assert(1 <= C <= 10 ** 4 and 1 <= A <= N and 1 <= B <= N and A != B) assert((A, B) not in check_set and (B, A) not in check_set) if i + 1 in R: nes_cost += C points.append((A - 1, B - 1)) check_set.add((A, B)) dist[A - 1][B - 1] = C dist[B - 1][A - 1] = C for i in range(N): for j in range(N): for k in range(N): dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]) for i in range(N): for j in range(N): assert(dist[i][j] < INF) import itertools ans = INF for v in itertools.permutations(points): for i in range(2 ** K): now = 0 now_cost = nes_cost for j in range(K): x, y = v[j] if 1 & (i >> j): now_cost += dist[now][x] now = y else: now_cost += dist[now][y] now = x now_cost += dist[now][N - 1] ans = min(ans, now_cost) print(ans)