結果

問題 No.2387 Yokan Factory
ユーザー nikoro256nikoro256
提出日時 2023-07-21 22:05:26
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 880 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 81,788 KB
実行使用メモリ 266,372 KB
最終ジャッジ日時 2023-10-21 22:07:05
合計ジャッジ時間 47,427 ms
ジャッジサーバーID
(参考情報)
judge9 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,480 KB
testcase_01 AC 41 ms
53,480 KB
testcase_02 AC 41 ms
53,480 KB
testcase_03 AC 41 ms
53,480 KB
testcase_04 AC 41 ms
53,480 KB
testcase_05 AC 41 ms
53,480 KB
testcase_06 AC 41 ms
53,480 KB
testcase_07 AC 41 ms
53,480 KB
testcase_08 AC 41 ms
53,480 KB
testcase_09 AC 40 ms
53,480 KB
testcase_10 AC 41 ms
53,480 KB
testcase_11 AC 41 ms
53,480 KB
testcase_12 AC 40 ms
53,480 KB
testcase_13 AC 40 ms
53,480 KB
testcase_14 AC 41 ms
53,480 KB
testcase_15 AC 3,535 ms
150,008 KB
testcase_16 AC 1,386 ms
148,268 KB
testcase_17 TLE -
testcase_18 AC 3,560 ms
167,072 KB
testcase_19 AC 3,328 ms
153,864 KB
testcase_20 AC 2,436 ms
125,232 KB
testcase_21 TLE -
testcase_22 AC 2,300 ms
122,188 KB
testcase_23 AC 3,713 ms
161,204 KB
testcase_24 AC 1,265 ms
110,684 KB
testcase_25 AC 2,251 ms
119,344 KB
testcase_26 AC 4,394 ms
181,912 KB
testcase_27 TLE -
testcase_28 AC 101 ms
76,288 KB
testcase_29 AC 121 ms
76,552 KB
testcase_30 AC 117 ms
76,740 KB
testcase_31 AC 105 ms
76,048 KB
testcase_32 AC 92 ms
75,780 KB
testcase_33 AC 88 ms
75,780 KB
testcase_34 AC 116 ms
76,640 KB
testcase_35 AC 109 ms
76,556 KB
testcase_36 AC 79 ms
74,324 KB
testcase_37 AC 41 ms
53,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
def daiku(s,num):
    hq=[]
    heapq.heappush(hq,[0,s])
    high=[-1 for _ in range(N)]
    karidist=[10**18+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