結果

問題 No.1473 おでぶなおばけさん
ユーザー terasaterasa
提出日時 2022-06-02 22:53:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,447 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 81,544 KB
実行使用メモリ 109,804 KB
最終ジャッジ日時 2023-10-21 01:20:57
合計ジャッジ時間 13,823 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,568 KB
testcase_01 AC 41 ms
55,568 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 458 ms
102,656 KB
testcase_08 AC 692 ms
102,088 KB
testcase_09 AC 394 ms
103,820 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 141 ms
83,884 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 188 ms
105,684 KB
testcase_23 AC 160 ms
103,156 KB
testcase_24 AC 160 ms
100,896 KB
testcase_25 AC 379 ms
104,156 KB
testcase_26 AC 241 ms
102,704 KB
testcase_27 AC 144 ms
81,032 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 129 ms
86,720 KB
testcase_35 AC 145 ms
87,196 KB
testcase_36 AC 259 ms
90,392 KB
testcase_37 AC 190 ms
100,000 KB
testcase_38 AC 87 ms
77,904 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 118 ms
85,816 KB
testcase_42 AC 115 ms
85,816 KB
testcase_43 AC 152 ms
95,488 KB
testcase_44 AC 150 ms
95,492 KB
testcase_45 AC 163 ms
95,492 KB
testcase_46 AC 207 ms
95,476 KB
testcase_47 AC 271 ms
100,576 KB
testcase_48 AC 251 ms
100,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import pypyjit
import itertools
import heapq
import math
from collections import deque, defaultdict
import bisect

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
pypyjit.set_param('max_unroll_recursion=-1')


def index_lt(a, x):
    'return largest index s.t. A[i] < x or -1 if it does not exist'
    return bisect.bisect_left(a, x) - 1


def index_le(a, x):
    'return largest index s.t. A[i] <= x or -1 if it does not exist'
    return bisect.bisect_right(a, x) - 1


def index_gt(a, x):
    'return smallest index s.t. A[i] > x or len(a) if it does not exist'
    return bisect.bisect_right(a, x)


def index_ge(a, x):
    'return smallest index s.t. A[i] >= x or len(a) if it does not exist'
    return bisect.bisect_left(a, x)


N, M = map(int, input().split())
E = [[] for _ in range(N)]
for _ in range(M):
    s, t, d = map(int, input().split())
    s -= 1
    t -= 1
    E[s].append((d, t))
    E[t].append((d, s))

INF = 1 << 30
l = -1
r = INF
ans = INF
while r - l > 1:
    w = (l + r) // 2

    dq = deque([0])
    C = [INF] * N
    C[0] = 0
    while len(dq) > 0:
        v = dq.popleft()
        if v == N - 1:
            break
        for d, dest in E[v]:
            if w > d:
                continue
            if C[dest] > C[v] + 1:
                C[dest] = C[v] + 1
                dq.append(dest)
    ans = min(ans, C[N - 1])
    if C[N - 1] < INF:
        l = w
    else:
        r = w
print(l, ans)
0