結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
59,664 KB
testcase_01 AC 37 ms
53,880 KB
testcase_02 AC 36 ms
52,880 KB
testcase_03 AC 36 ms
53,668 KB
testcase_04 AC 36 ms
53,772 KB
testcase_05 AC 37 ms
53,744 KB
testcase_06 AC 36 ms
53,740 KB
testcase_07 AC 37 ms
53,420 KB
testcase_08 AC 41 ms
59,668 KB
testcase_09 AC 53 ms
65,428 KB
testcase_10 AC 54 ms
66,240 KB
testcase_11 AC 43 ms
60,896 KB
testcase_12 AC 44 ms
62,128 KB
testcase_13 AC 72 ms
83,160 KB
testcase_14 AC 58 ms
74,736 KB
testcase_15 AC 276 ms
87,668 KB
testcase_16 AC 163 ms
84,208 KB
testcase_17 AC 189 ms
83,856 KB
testcase_18 AC 87 ms
80,764 KB
testcase_19 AC 160 ms
83,508 KB
testcase_20 AC 250 ms
84,656 KB
testcase_21 AC 71 ms
81,792 KB
testcase_22 AC 55 ms
72,292 KB
testcase_23 AC 87 ms
84,352 KB
testcase_24 AC 341 ms
87,856 KB
testcase_25 AC 488 ms
92,160 KB
testcase_26 AC 354 ms
94,664 KB
testcase_27 AC 330 ms
87,288 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