結果
問題 | No.1473 おでぶなおばけさん |
ユーザー | buey_t |
提出日時 | 2023-03-26 10:47:50 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,319 bytes |
コンパイル時間 | 213 ms |
コンパイル使用メモリ | 82,236 KB |
実行使用メモリ | 121,652 KB |
最終ジャッジ日時 | 2024-09-19 09:36:50 |
合計ジャッジ時間 | 18,573 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 127 ms
84,992 KB |
testcase_01 | AC | 123 ms
84,992 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
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 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 636 ms
114,908 KB |
testcase_23 | AC | 566 ms
109,624 KB |
testcase_24 | AC | 646 ms
110,772 KB |
testcase_25 | AC | 569 ms
111,980 KB |
testcase_26 | AC | 409 ms
111,956 KB |
testcase_27 | AC | 341 ms
98,176 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | AC | 540 ms
111,776 KB |
testcase_37 | AC | 332 ms
109,956 KB |
testcase_38 | AC | 203 ms
91,136 KB |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
ソースコード
def main(): from math import sqrt,sin,cos,tan,ceil,radians,floor,gcd,exp,log,log10,log2,factorial,fsum from heapq import heapify, heappop, heappush from bisect import bisect_left, bisect_right from copy import deepcopy import copy import random from collections import deque,Counter,defaultdict from itertools import permutations,combinations from decimal import Decimal,ROUND_HALF_UP #tmp = Decimal(mid).quantize(Decimal('0'), rounding=ROUND_HALF_UP) from functools import lru_cache, reduce #@lru_cache(maxsize=None) from operator import add,sub,mul,xor,and_,or_,itemgetter INF = 10**18 mod1 = 10**9+7 mod2 = 998244353 #DecimalならPython #再帰ならPython!!!!!!!!!!!!!!!!!!!!!!!!!! ''' ''' N,M = map(int, input().split()) G = [[] for _ in range(N+1)] w = [] for _ in range(M): a,b,c = map(int, input().split()) G[a].append((b,c)) G[b].append((a,c)) w.append(c) w.sort() r = M-1 l = 0 while r-l > 1: m = (r+l)//2 Q = deque() Q.append((1,0)) seen = [0]*(N+1) ans = -1 while len(Q) > 0: pos,cnt = Q.popleft() if seen[pos] == 1: continue seen[pos] = 1 if pos == N: ans = cnt break for nx,d in G[pos]: if d >= w[m] and seen[nx] == 0: Q.append((nx,cnt+1)) if ans == -1: l = m else: r = m Q = deque() Q.append((1,0)) seen = [0]*(N+1) ans = -1 while len(Q) > 0: pos,cnt = Q.popleft() if seen[pos] == 1: continue seen[pos] = 1 if pos == N: ans = cnt break for nx,d in G[pos]: if d >= w[r] and seen[nx] == 0: Q.append((nx,cnt+1)) print(w[r],ans) if __name__ == '__main__': main()