結果

問題 No.2387 Yokan Factory
ユーザー ikomaikoma
提出日時 2023-07-21 21:42:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,725 ms / 5,000 ms
コード長 773 bytes
コンパイル時間 883 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 184,644 KB
最終ジャッジ日時 2023-10-21 21:40:11
合計ジャッジ時間 22,416 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,476 KB
testcase_01 AC 39 ms
53,476 KB
testcase_02 AC 38 ms
53,476 KB
testcase_03 AC 39 ms
53,476 KB
testcase_04 AC 39 ms
53,476 KB
testcase_05 AC 40 ms
53,476 KB
testcase_06 AC 40 ms
53,476 KB
testcase_07 AC 39 ms
53,476 KB
testcase_08 AC 39 ms
53,476 KB
testcase_09 AC 39 ms
53,476 KB
testcase_10 AC 39 ms
53,476 KB
testcase_11 AC 40 ms
53,476 KB
testcase_12 AC 40 ms
53,476 KB
testcase_13 AC 40 ms
53,476 KB
testcase_14 AC 40 ms
53,476 KB
testcase_15 AC 1,054 ms
135,180 KB
testcase_16 AC 463 ms
126,348 KB
testcase_17 AC 1,291 ms
184,644 KB
testcase_18 AC 1,723 ms
131,988 KB
testcase_19 AC 1,268 ms
112,340 KB
testcase_20 AC 966 ms
104,992 KB
testcase_21 AC 2,106 ms
136,504 KB
testcase_22 AC 795 ms
102,480 KB
testcase_23 AC 2,017 ms
122,224 KB
testcase_24 AC 559 ms
103,308 KB
testcase_25 AC 1,224 ms
101,572 KB
testcase_26 AC 2,223 ms
131,864 KB
testcase_27 AC 2,725 ms
139,696 KB
testcase_28 AC 91 ms
76,884 KB
testcase_29 AC 111 ms
76,980 KB
testcase_30 AC 98 ms
76,700 KB
testcase_31 AC 106 ms
76,388 KB
testcase_32 AC 89 ms
76,100 KB
testcase_33 AC 89 ms
76,104 KB
testcase_34 AC 113 ms
76,920 KB
testcase_35 AC 113 ms
76,712 KB
testcase_36 AC 73 ms
72,544 KB
testcase_37 AC 41 ms
53,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from heapq import heappush,heappop
INF=1<<60
N,M,X=map(int,input().split())
UVAB=[list(map(int,input().split())) for _ in range(M)]
edge = [[] for _ in range(N)]
for u,v,a,b in UVAB:
    u-=1;v-=1
    edge[u].append((v,a,b))
    edge[v].append((u,a,b))

def check(B):
    time = [INF]*N
    time[0]=0
    que = [(0,0)]
    while que:
        x,v = heappop(que)
        if time[v]<x:continue
        for to,a,b in edge[v]:
            if b<B:continue
            x2 = x+a
            if x2 >= time[to]:continue
            time[to]=x2
            heappush(que, (x2,to))
        if time[-1]<=X:return True
    return False

ok,ng=-1,10**9+1
while ok+1<ng:
    m = ok+ng>>1
    if check(m):
        ok=m
    else:
        ng=m
print(ok)

0