結果

問題 No.2387 Yokan Factory
ユーザー hato336hato336
提出日時 2023-07-21 21:50:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,499 ms / 5,000 ms
コード長 1,148 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 81,692 KB
実行使用メモリ 188,464 KB
最終ジャッジ日時 2023-10-21 21:50:57
合計ジャッジ時間 25,880 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
84,976 KB
testcase_01 AC 127 ms
84,976 KB
testcase_02 AC 127 ms
84,980 KB
testcase_03 AC 127 ms
84,976 KB
testcase_04 AC 128 ms
84,972 KB
testcase_05 AC 126 ms
84,980 KB
testcase_06 AC 125 ms
84,976 KB
testcase_07 AC 118 ms
84,976 KB
testcase_08 AC 118 ms
84,980 KB
testcase_09 AC 117 ms
84,976 KB
testcase_10 AC 117 ms
84,976 KB
testcase_11 AC 121 ms
84,976 KB
testcase_12 AC 128 ms
84,976 KB
testcase_13 AC 123 ms
84,976 KB
testcase_14 AC 117 ms
84,936 KB
testcase_15 AC 1,031 ms
137,360 KB
testcase_16 AC 623 ms
133,724 KB
testcase_17 AC 1,537 ms
188,464 KB
testcase_18 AC 1,769 ms
136,144 KB
testcase_19 AC 1,775 ms
126,720 KB
testcase_20 AC 1,368 ms
116,144 KB
testcase_21 AC 2,499 ms
142,760 KB
testcase_22 AC 1,283 ms
115,024 KB
testcase_23 AC 1,946 ms
130,004 KB
testcase_24 AC 851 ms
111,492 KB
testcase_25 AC 1,144 ms
110,940 KB
testcase_26 AC 2,211 ms
138,600 KB
testcase_27 AC 2,496 ms
144,440 KB
testcase_28 AC 185 ms
90,200 KB
testcase_29 AC 212 ms
90,540 KB
testcase_30 AC 192 ms
90,240 KB
testcase_31 AC 184 ms
89,560 KB
testcase_32 AC 168 ms
89,088 KB
testcase_33 AC 170 ms
89,108 KB
testcase_34 AC 209 ms
90,380 KB
testcase_35 AC 216 ms
90,272 KB
testcase_36 AC 170 ms
89,084 KB
testcase_37 AC 118 ms
84,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#n = int(input())
#alist = list(map(int,input().split()))
#alist = []
#s = input()
n,m,X = map(int,input().split())
edge = [[] for i in range(n)]
for i in range(m):
    u,v,a,b = map(int,input().split())
    u,v = u-1,v-1
    edge[u].append((v,a,b))
    edge[v].append((u,a,b))
#for i in range(n):
#    alist.append(list(map(int,input().split())))

class nibutan():
    def __init__(self):
        self.max = 10**9+10
    def __len__(self):
        return self.max
    def __getitem__(self,x):
        d = []
        d.append((0,0))
        dist = [10**18] * n
        dist[0] = 0
        while d:
            _,now = heapq.heappop(d)
            if _ > dist[now]:
                continue
            for i in edge[now]:
                if i[2] < x:
                    continue
                if dist[now] + i[1] < dist[i[0]]:
                    dist[i[0]] = dist[now] + i[1]
                    heapq.heappush(d,(dist[i[0]],i[0]))
        return 1 if dist[-1] > X else 0
    
print(bisect.bisect_left(nibutan(),1)-1)
0