結果
問題 | No.2387 Yokan Factory |
ユーザー | Navier_Boltzmann |
提出日時 | 2023-07-24 03:44:07 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 2,964 ms / 5,000 ms |
コード長 | 1,007 bytes |
コンパイル時間 | 1,603 ms |
コンパイル使用メモリ | 81,516 KB |
実行使用メモリ | 180,980 KB |
最終ジャッジ日時 | 2023-10-25 22:14:06 |
合計ジャッジ時間 | 23,955 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
55,600 KB |
testcase_01 | AC | 45 ms
55,600 KB |
testcase_02 | AC | 46 ms
55,600 KB |
testcase_03 | AC | 45 ms
55,600 KB |
testcase_04 | AC | 45 ms
55,600 KB |
testcase_05 | AC | 44 ms
55,600 KB |
testcase_06 | AC | 43 ms
55,600 KB |
testcase_07 | AC | 45 ms
55,600 KB |
testcase_08 | AC | 44 ms
55,600 KB |
testcase_09 | AC | 44 ms
55,600 KB |
testcase_10 | AC | 44 ms
55,600 KB |
testcase_11 | AC | 45 ms
55,596 KB |
testcase_12 | AC | 44 ms
55,596 KB |
testcase_13 | AC | 45 ms
55,600 KB |
testcase_14 | AC | 45 ms
55,596 KB |
testcase_15 | AC | 1,077 ms
128,152 KB |
testcase_16 | AC | 654 ms
128,476 KB |
testcase_17 | AC | 1,562 ms
180,980 KB |
testcase_18 | AC | 2,070 ms
126,676 KB |
testcase_19 | AC | 1,938 ms
115,620 KB |
testcase_20 | AC | 1,554 ms
106,128 KB |
testcase_21 | AC | 2,964 ms
133,912 KB |
testcase_22 | AC | 1,386 ms
104,696 KB |
testcase_23 | AC | 1,976 ms
117,208 KB |
testcase_24 | AC | 916 ms
101,500 KB |
testcase_25 | AC | 189 ms
87,732 KB |
testcase_26 | AC | 277 ms
96,844 KB |
testcase_27 | AC | 314 ms
99,892 KB |
testcase_28 | AC | 122 ms
77,924 KB |
testcase_29 | AC | 142 ms
78,260 KB |
testcase_30 | AC | 138 ms
78,164 KB |
testcase_31 | AC | 130 ms
77,516 KB |
testcase_32 | AC | 105 ms
76,812 KB |
testcase_33 | AC | 95 ms
76,912 KB |
testcase_34 | AC | 155 ms
78,332 KB |
testcase_35 | AC | 87 ms
77,520 KB |
testcase_36 | AC | 94 ms
76,864 KB |
testcase_37 | AC | 44 ms
55,680 KB |
ソースコード
from collections import * from itertools import * from functools import * from heapq import * import sys,math sys.setrecursionlimit(3*10**5) input = sys.stdin.readline INF = (1<<60) N,M,X = map(int,input().split()) e = [[] for _ in range(N)] for _ in range(M): u,v,a,b = map(int,input().split()) u -= 1 v -= 1 e[u].append((v,a,b)) e[v].append((u,a,b)) def dijkstra(s,e,t): N = len(e) dist = [INF]*N dist[s]=0 h = [] heappush(h,(0,s)) while h: nw,v = heappop(h) if dist[v]!=nw: continue for iv,ic,iw in e[v]: if iw<t: continue nc = ic + nw if nc < dist[iv]: dist[iv] = nc heappush(h,(nc,iv)) return dist def is_ok(T): D = dijkstra(0,e,T) return D[-1]<=X if not is_ok(1): print(-1) exit() y = 10**9 + 100 x = 1 while y-x>1: mid = (y+x)//2 if is_ok(mid): x = mid else: y = mid print(x)