結果

問題 No.2387 Yokan Factory
ユーザー nikoro256nikoro256
提出日時 2023-07-21 22:13:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 879 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 81,448 KB
実行使用メモリ 266,104 KB
最終ジャッジ日時 2023-10-21 22:14:22
合計ジャッジ時間 18,505 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,384 KB
testcase_01 AC 38 ms
53,384 KB
testcase_02 AC 36 ms
53,384 KB
testcase_03 AC 39 ms
53,384 KB
testcase_04 AC 36 ms
53,384 KB
testcase_05 AC 36 ms
53,384 KB
testcase_06 AC 36 ms
53,384 KB
testcase_07 AC 36 ms
53,384 KB
testcase_08 AC 36 ms
53,384 KB
testcase_09 AC 34 ms
53,384 KB
testcase_10 AC 35 ms
53,384 KB
testcase_11 AC 36 ms
53,384 KB
testcase_12 AC 35 ms
53,384 KB
testcase_13 AC 35 ms
53,384 KB
testcase_14 AC 37 ms
53,384 KB
testcase_15 AC 3,106 ms
149,848 KB
testcase_16 AC 1,240 ms
148,068 KB
testcase_17 AC 4,646 ms
266,104 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 3,495 ms
175,616 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 267 ms
90,048 KB
testcase_26 AC 394 ms
101,020 KB
testcase_27 AC 452 ms
108,780 KB
testcase_28 AC 85 ms
76,120 KB
testcase_29 AC 104 ms
76,384 KB
testcase_30 AC 102 ms
76,580 KB
testcase_31 AC 94 ms
75,880 KB
testcase_32 AC 80 ms
75,608 KB
testcase_33 AC 76 ms
75,612 KB
testcase_34 AC 105 ms
76,476 KB
testcase_35 AC 97 ms
76,388 KB
testcase_36 AC 70 ms
74,152 KB
testcase_37 AC 37 ms
53,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
def daiku(s,num):
    hq=[]
    heapq.heappush(hq,[0,s])
    high=[-1 for _ in range(N)]
    karidist=[10**9+1 for _ in range(N)]
    while len(hq)!=0:
        h,p=heapq.heappop(hq)
        if high[p]==-1:
            high[p]=h
            for e,c,m in edge[p]:
                if m>=num and karidist[e]>h+c:
                    karidist[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