結果

問題 No.1473 おでぶなおばけさん
ユーザー lie_of_lillielie_of_lillie
提出日時 2021-05-14 15:55:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 963 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 82,344 KB
実行使用メモリ 139,260 KB
最終ジャッジ日時 2024-04-09 20:14:32
合計ジャッジ時間 18,335 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
54,716 KB
testcase_01 AC 42 ms
55,612 KB
testcase_02 AC 646 ms
125,412 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 582 ms
115,036 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 149 ms
81,384 KB
testcase_15 AC 216 ms
86,636 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 84 ms
77,368 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 320 ms
130,332 KB
testcase_23 AC 280 ms
129,744 KB
testcase_24 AC 290 ms
121,484 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 583 ms
105,636 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 360 ms
114,768 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 359 ms
95,168 KB
testcase_37 WA -
testcase_38 AC 158 ms
79,544 KB
testcase_39 WA -
testcase_40 AC 169 ms
84,980 KB
testcase_41 AC 264 ms
87,784 KB
testcase_42 AC 262 ms
87,736 KB
testcase_43 AC 245 ms
99,116 KB
testcase_44 AC 245 ms
99,104 KB
testcase_45 AC 249 ms
99,244 KB
testcase_46 WA -
testcase_47 AC 470 ms
120,564 KB
testcase_48 AC 443 ms
114,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
import heapq
import math

N,M=map(int,input().split())

G = collections.defaultdict(list)

for _ in range(M):
    S,T,D = map(int, input().split())
    G[S-1].append((T-1,D))
    G[T-1].append((S-1,D))

def bfs(max_w):
    que = collections.deque([(0,0)]) # index, something val
    visited = [-1]*N
    while que:
        i, c = que.popleft() # queはFIFO
        if visited[i] >= 0:
            continue
        visited[i] = c
        for j, d in G[i]:
            if visited[j] == -1 and max_w <= d: # まだ未踏のノードであれば
                que.append((j,c+1)) # 自分の値に+1してqueに入れる
    return visited[-1]

def check(n):
  r = R - n
  b = B - n
  if r<0 or b<0:
    return False
  num = r // (x-1) + b // (y-1)
  return num >= n

ok = 0
ng = 1 << 64
while(True):
    mid = (ok+ng) // 2
    if bfs(mid) != -1:
        ok = mid
    else:
        ng = mid
    if ng - ok == 1:
        break
print(mid, bfs(mid))
0