結果
問題 | No.2387 Yokan Factory |
ユーザー | cleantted |
提出日時 | 2023-06-14 03:50:08 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 2,109 ms / 5,000 ms |
コード長 | 2,206 bytes |
コンパイル時間 | 187 ms |
コンパイル使用メモリ | 82,816 KB |
実行使用メモリ | 201,592 KB |
最終ジャッジ日時 | 2024-06-23 20:11:52 |
合計ジャッジ時間 | 23,348 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 189 ms
90,496 KB |
testcase_01 | AC | 187 ms
90,604 KB |
testcase_02 | AC | 189 ms
90,256 KB |
testcase_03 | AC | 190 ms
90,464 KB |
testcase_04 | AC | 190 ms
90,240 KB |
testcase_05 | AC | 192 ms
90,368 KB |
testcase_06 | AC | 198 ms
90,624 KB |
testcase_07 | AC | 188 ms
90,368 KB |
testcase_08 | AC | 188 ms
90,108 KB |
testcase_09 | AC | 190 ms
90,304 KB |
testcase_10 | AC | 190 ms
90,368 KB |
testcase_11 | AC | 188 ms
90,496 KB |
testcase_12 | AC | 188 ms
90,368 KB |
testcase_13 | AC | 190 ms
90,468 KB |
testcase_14 | AC | 194 ms
90,240 KB |
testcase_15 | AC | 1,275 ms
145,120 KB |
testcase_16 | AC | 524 ms
134,492 KB |
testcase_17 | AC | 1,384 ms
201,592 KB |
testcase_18 | AC | 1,868 ms
149,132 KB |
testcase_19 | AC | 1,310 ms
135,696 KB |
testcase_20 | AC | 772 ms
118,208 KB |
testcase_21 | AC | 1,848 ms
156,524 KB |
testcase_22 | AC | 773 ms
118,936 KB |
testcase_23 | AC | 1,907 ms
140,716 KB |
testcase_24 | AC | 754 ms
115,960 KB |
testcase_25 | AC | 853 ms
118,828 KB |
testcase_26 | AC | 2,109 ms
148,864 KB |
testcase_27 | AC | 840 ms
137,692 KB |
testcase_28 | AC | 203 ms
93,572 KB |
testcase_29 | AC | 227 ms
93,440 KB |
testcase_30 | AC | 226 ms
93,320 KB |
testcase_31 | AC | 222 ms
93,056 KB |
testcase_32 | AC | 196 ms
92,884 KB |
testcase_33 | AC | 207 ms
93,272 KB |
testcase_34 | AC | 224 ms
93,800 KB |
testcase_35 | AC | 243 ms
94,224 KB |
testcase_36 | AC | 196 ms
92,820 KB |
testcase_37 | AC | 169 ms
90,368 KB |
ソースコード
# import bisect import copy import heapq import itertools import math import operator import random import sys from bisect import bisect, bisect_left, bisect_right, insort from collections import Counter, deque from fractions import Fraction from functools import cmp_to_key, lru_cache, partial from inspect import currentframe from math import ceil, gcd, log10, pi, sqrt from typing import Iterable, Iterator, List, Tuple, TypeVar, Union # import pypyjit # pypyjit.set_param('max_unroll_recursion=-1') # import string # import networkx as nx input = sys.stdin.readline sys.setrecursionlimit(10000000) # mod = 10 ** 9 + 7 mod = 998244353 # mod = 1 << 128 # mod = 10 ** 30 + 1 INF = 1 << 61 DIFF = 10 ** -9 DX = [1, 0, -1, 0, 1, 1, -1, -1] DY = [0, 1, 0, -1, 1, -1, 1, -1] def read_values(): return tuple(map(int, input().split())) def read_index(): return tuple(map(lambda x: int(x) - 1, input().split())) def read_list(): return list(read_values()) def read_lists(N): return [read_list() for _ in range(N)] def dprint(*values): print(*values, file=sys.stderr) def dprint2(*values): names = {id(v): k for k, v in currentframe().f_back.f_locals.items()} dprint(", ".join(f"{names.get(id(value), '???')}={repr(value)}" for value in values)) def main(): N, M, X = read_values() G = [[] for _ in range(N)] for _ in range(M): u, v, a, b = read_values() u -= 1 v -= 1 G[u].append((v, a, b)) G[v].append((u, a, b)) l = -1 r = 10 ** 9 + 10 while r - l > 1: m = (l + r) // 2 S = [(0, 0)] fixed = [False] * N D = [INF] * N D[0] = 0 while S: c, i = heapq.heappop(S) if i == N - 1: break if fixed[i]: continue fixed[i] = True for j, a, b in G[i]: if m > b: continue if D[j] <= c + a: continue D[j] = c + a heapq.heappush(S, (c + a, j)) if D[N - 1] <= X: l = m else: r = m print(l) if __name__ == "__main__": main()