結果

問題 No.2387 Yokan Factory
ユーザー nikoro256nikoro256
提出日時 2023-07-21 22:27:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 4,990 ms / 5,000 ms
コード長 873 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 11,944 KB
実行使用メモリ 54,004 KB
最終ジャッジ日時 2023-10-21 22:27:27
合計ジャッジ時間 43,692 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,160 KB
testcase_01 AC 27 ms
10,160 KB
testcase_02 AC 25 ms
10,160 KB
testcase_03 AC 25 ms
10,160 KB
testcase_04 AC 25 ms
10,160 KB
testcase_05 AC 29 ms
10,160 KB
testcase_06 AC 26 ms
10,160 KB
testcase_07 AC 25 ms
10,160 KB
testcase_08 AC 27 ms
10,160 KB
testcase_09 AC 26 ms
10,160 KB
testcase_10 AC 25 ms
10,160 KB
testcase_11 AC 26 ms
10,160 KB
testcase_12 AC 26 ms
10,160 KB
testcase_13 AC 25 ms
10,160 KB
testcase_14 AC 26 ms
10,160 KB
testcase_15 AC 2,903 ms
49,748 KB
testcase_16 AC 1,730 ms
52,064 KB
testcase_17 AC 4,321 ms
54,004 KB
testcase_18 AC 3,701 ms
47,176 KB
testcase_19 AC 3,330 ms
35,236 KB
testcase_20 AC 2,341 ms
33,200 KB
testcase_21 AC 4,747 ms
44,100 KB
testcase_22 AC 2,202 ms
31,032 KB
testcase_23 AC 3,630 ms
35,428 KB
testcase_24 AC 1,199 ms
32,284 KB
testcase_25 AC 1,918 ms
25,268 KB
testcase_26 AC 4,339 ms
39,296 KB
testcase_27 AC 4,990 ms
43,364 KB
testcase_28 AC 38 ms
10,648 KB
testcase_29 AC 44 ms
10,840 KB
testcase_30 AC 39 ms
10,784 KB
testcase_31 AC 36 ms
10,516 KB
testcase_32 AC 32 ms
10,380 KB
testcase_33 AC 30 ms
10,360 KB
testcase_34 AC 41 ms
10,772 KB
testcase_35 AC 37 ms
10,632 KB
testcase_36 AC 30 ms
10,344 KB
testcase_37 AC 25 ms
10,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


import heapq
def daiku(s,num):
    hq=[]
    heapq.heappush(hq,[0,s])
    high=[10**14+1 for _ in range(N)]
    use=[False for _ in range(N)]
    while len(hq)!=0:
        h,p=heapq.heappop(hq)
        if not use[p]:
            use[p]=True
            for e,c,m in edge[p]:
                if m>=num and high[e]>h+c:
                    high[e]=h+c
                    heapq.heappush(hq,[h+c,e])
    return high[-1]

def nibun():
    left,right=-1,10**9+1
    while right-left>1:
        mid=(right+left)//2
        dist=daiku(0,mid)
        if dist!=-1 and dist<=X:
            left=mid
        else:
            right=mid
    return left

import sys
input=sys.stdin.readline
N,M,X=map(int,input().split())
edge=[[] for _ in range(N)]
for _ in range(M):
    u,v,a,b=map(int,input().split())
    edge[u-1].append([v-1,a,b])
    edge[v-1].append([u-1,a,b])
print(nibun())
0