結果

問題 No.1473 おでぶなおばけさん
ユーザー buey_tbuey_t
提出日時 2023-03-26 10:04:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,617 bytes
コンパイル時間 1,691 ms
コンパイル使用メモリ 81,404 KB
実行使用メモリ 115,572 KB
最終ジャッジ日時 2023-10-19 13:21:12
合計ジャッジ時間 24,984 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
84,200 KB
testcase_01 AC 129 ms
84,204 KB
testcase_02 AC 595 ms
107,988 KB
testcase_03 WA -
testcase_04 AC 407 ms
98,568 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 478 ms
106,136 KB
testcase_08 WA -
testcase_09 AC 487 ms
106,172 KB
testcase_10 AC 341 ms
107,452 KB
testcase_11 WA -
testcase_12 AC 282 ms
97,212 KB
testcase_13 AC 249 ms
94,792 KB
testcase_14 AC 248 ms
95,728 KB
testcase_15 AC 330 ms
108,244 KB
testcase_16 AC 298 ms
101,068 KB
testcase_17 AC 188 ms
89,956 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 647 ms
111,320 KB
testcase_22 AC 639 ms
109,968 KB
testcase_23 AC 523 ms
102,928 KB
testcase_24 AC 667 ms
107,680 KB
testcase_25 AC 662 ms
109,556 KB
testcase_26 AC 448 ms
104,276 KB
testcase_27 AC 415 ms
99,072 KB
testcase_28 AC 456 ms
105,884 KB
testcase_29 AC 387 ms
100,592 KB
testcase_30 AC 445 ms
103,676 KB
testcase_31 AC 638 ms
108,860 KB
testcase_32 WA -
testcase_33 AC 535 ms
105,604 KB
testcase_34 AC 294 ms
95,576 KB
testcase_35 AC 400 ms
99,160 KB
testcase_36 AC 658 ms
107,104 KB
testcase_37 AC 362 ms
100,852 KB
testcase_38 AC 229 ms
91,320 KB
testcase_39 AC 280 ms
100,052 KB
testcase_40 AC 288 ms
101,316 KB
testcase_41 AC 315 ms
112,468 KB
testcase_42 AC 314 ms
112,464 KB
testcase_43 AC 549 ms
115,572 KB
testcase_44 AC 548 ms
115,572 KB
testcase_45 AC 548 ms
115,568 KB
testcase_46 AC 399 ms
100,060 KB
testcase_47 AC 454 ms
103,044 KB
testcase_48 AC 446 ms
102,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)]
    
    for _ in range(M):
        u,v,w = map(int, input().split())
        G[u].append((v,w))
        G[v].append((u,w))
    
    Q = []
    heappush(Q,(-INF,0,1))
    
    seen = [0]*(N+1)
    while len(Q) > 0:
        mx,cnt,pos = heappop(Q)
        mx = -mx
        
        if seen[pos] != 0:
            continue
        seen[pos] = 1
        
        if pos == N:
            print(mx,cnt)
            exit()
        
        for nx,w in G[pos]:
            if seen[nx] == 0:
                heappush(Q,(-min(mx,w),cnt+1,nx))
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
if __name__ == '__main__':
    main()
0