結果

問題 No.1480 Many Complete Graphs
ユーザー ああいいああいい
提出日時 2021-12-28 22:15:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 717 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 82,348 KB
実行使用メモリ 102,740 KB
最終ジャッジ日時 2024-04-10 14:36:46
合計ジャッジ時間 9,568 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 35 ms
53,668 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 66 ms
83,024 KB
testcase_14 AC 53 ms
74,116 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 84 ms
80,780 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 73 ms
81,848 KB
testcase_22 AC 57 ms
71,352 KB
testcase_23 AC 90 ms
84,400 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 TLE -
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))
                break
print(-1)
0