結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
59,820 KB
testcase_01 AC 38 ms
52,744 KB
testcase_02 AC 38 ms
53,704 KB
testcase_03 AC 38 ms
53,748 KB
testcase_04 AC 38 ms
53,496 KB
testcase_05 AC 38 ms
53,760 KB
testcase_06 AC 38 ms
53,196 KB
testcase_07 AC 39 ms
54,516 KB
testcase_08 AC 43 ms
59,536 KB
testcase_09 AC 59 ms
68,632 KB
testcase_10 AC 53 ms
65,412 KB
testcase_11 AC 44 ms
61,228 KB
testcase_12 AC 47 ms
61,132 KB
testcase_13 AC 79 ms
82,932 KB
testcase_14 AC 64 ms
75,480 KB
testcase_15 AC 285 ms
88,252 KB
testcase_16 AC 168 ms
84,412 KB
testcase_17 AC 206 ms
83,768 KB
testcase_18 AC 94 ms
80,900 KB
testcase_19 AC 170 ms
83,972 KB
testcase_20 AC 262 ms
85,208 KB
testcase_21 AC 78 ms
81,476 KB
testcase_22 AC 61 ms
74,548 KB
testcase_23 AC 88 ms
83,828 KB
testcase_24 AC 360 ms
86,972 KB
testcase_25 AC 520 ms
92,916 KB
testcase_26 AC 351 ms
95,504 KB
testcase_27 AC 336 ms
87,228 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 #

N,M = map(int,input().split())
G = [[] for _ in range(N + 1 + M)]
for i in range(M):
    l = list(map(int,input().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
import sys
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