結果

問題 No.2387 Yokan Factory
ユーザー komkompikomkompi
提出日時 2023-07-22 01:27:29
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 845 bytes
コンパイル時間 450 ms
コンパイル使用メモリ 81,688 KB
実行使用メモリ 192,424 KB
最終ジャッジ日時 2023-10-22 01:12:24
合計ジャッジ時間 8,054 ms
ジャッジサーバーID
(参考情報)
judge9 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,456 KB
testcase_01 AC 35 ms
53,456 KB
testcase_02 AC 35 ms
53,456 KB
testcase_03 AC 35 ms
53,456 KB
testcase_04 AC 37 ms
53,456 KB
testcase_05 AC 37 ms
53,456 KB
testcase_06 AC 36 ms
53,456 KB
testcase_07 AC 36 ms
53,456 KB
testcase_08 AC 37 ms
53,456 KB
testcase_09 AC 36 ms
53,456 KB
testcase_10 AC 37 ms
53,456 KB
testcase_11 AC 37 ms
53,456 KB
testcase_12 AC 35 ms
53,456 KB
testcase_13 AC 35 ms
53,456 KB
testcase_14 AC 39 ms
53,456 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
import heapq as hq

def dijkstra(edges,start,size):
    n_node=len(edges)
    costs=[float("inf") for i in range(n_node)]
    
    
    queue=[[0,start]]
    
    while queue:
        cost,now=hq.heappop(queue)
        if costs[now]>cost:
            costs[now]=cost
            for n_cost,width,nxt in edges[now]:
                if width>=size:
                    hq.heappush(queue,[cost+n_cost,nxt])
 
    return costs[:]

N,M,X=map(int,input().split())

edges=[[] for i in range(N)]

for _ in range(M):
    u,v,a,b=map(int,input().split())
    edges[u-1].append([a,b,v-1])
    edges[v-1].append([a,b,u-1])
    

high=10**9+1
low=-1

while high-low>1:
    middle=(high+low)//2
    
    costs=dijkstra(edges[:],0,middle)
    
    if costs[-1]<=X:
        low=middle
    else:
        high=middle


print(low)
0