結果

問題 No.2387 Yokan Factory
ユーザー nikoro256nikoro256
提出日時 2023-07-21 21:55:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 810 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 81,896 KB
実行使用メモリ 264,932 KB
最終ジャッジ日時 2023-10-21 21:56:01
合計ジャッジ時間 21,519 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,552 KB
testcase_01 AC 38 ms
53,552 KB
testcase_02 AC 36 ms
53,552 KB
testcase_03 AC 40 ms
53,552 KB
testcase_04 AC 35 ms
53,552 KB
testcase_05 AC 36 ms
53,552 KB
testcase_06 AC 36 ms
53,552 KB
testcase_07 AC 37 ms
53,552 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 35 ms
53,552 KB
testcase_11 AC 35 ms
53,552 KB
testcase_12 AC 37 ms
53,552 KB
testcase_13 AC 37 ms
53,552 KB
testcase_14 AC 37 ms
53,552 KB
testcase_15 AC 2,045 ms
140,824 KB
testcase_16 AC 256 ms
105,832 KB
testcase_17 AC 4,825 ms
264,932 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 267 ms
86,332 KB
testcase_26 AC 282 ms
94,288 KB
testcase_27 AC 1,626 ms
117,900 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 115 ms
76,580 KB
testcase_36 WA -
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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])
print(nibun())
0