結果

問題 No.1480 Many Complete Graphs
ユーザー ああいいああいい
提出日時 2021-12-28 22:14:55
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 695 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 82,164 KB
実行使用メモリ 102,616 KB
最終ジャッジ日時 2024-04-10 14:35:16
合計ジャッジ時間 8,960 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
57,984 KB
testcase_01 AC 41 ms
52,992 KB
testcase_02 AC 41 ms
52,864 KB
testcase_03 AC 42 ms
52,992 KB
testcase_04 AC 42 ms
52,736 KB
testcase_05 AC 42 ms
52,736 KB
testcase_06 AC 43 ms
52,736 KB
testcase_07 AC 43 ms
52,736 KB
testcase_08 AC 46 ms
59,520 KB
testcase_09 AC 61 ms
65,152 KB
testcase_10 AC 63 ms
65,664 KB
testcase_11 AC 50 ms
60,160 KB
testcase_12 AC 52 ms
61,696 KB
testcase_13 AC 86 ms
83,072 KB
testcase_14 AC 68 ms
72,980 KB
testcase_15 AC 329 ms
87,936 KB
testcase_16 AC 195 ms
84,492 KB
testcase_17 AC 235 ms
83,844 KB
testcase_18 AC 102 ms
80,656 KB
testcase_19 AC 198 ms
83,712 KB
testcase_20 AC 309 ms
84,784 KB
testcase_21 AC 88 ms
81,824 KB
testcase_22 AC 65 ms
71,424 KB
testcase_23 AC 108 ms
84,680 KB
testcase_24 AC 412 ms
87,588 KB
testcase_25 AC 596 ms
92,172 KB
testcase_26 AC 416 ms
94,408 KB
testcase_27 AC 397 ms
87,160 KB
testcase_28 TLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
evil_aftercontest.txt -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
r = sys.stdin

N,M = map(int,r.readline().split())
G = [[] for _ in range(N + 1 + M)]
for i in range(M):
    l = list(map(int,r.readline().split()))
    for k in range(2,len(l)):
        G[l[k]].append(N + i + 1)
        G[N + i + 1].append((l[k],l[1]))

import heapq
q = []
heapq.heapify(q)
heapq.heappush(q,(0,1))
C = 10 ** 16
dist = [C] * (N + 1)
dist[1] = 0
while len(q):
    d,i = heapq.heappop(q)
    if i == N:
        print(d)
        exit()
    if d > dist[i]:
        continue
    for m in G[i]:
        for s,c in G[m]:
            u = (i + s + 1) // 2 + c + dist[i]
            if u < dist[s]:
                dist[s] = u
                heapq.heappush(q,(u,s))
print(-1)
0