結果

問題 No.1473 おでぶなおばけさん
ユーザー buey_tbuey_t
提出日時 2023-03-26 10:11:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,705 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 81,772 KB
実行使用メモリ 107,428 KB
最終ジャッジ日時 2023-10-19 13:22:18
合計ジャッジ時間 19,845 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
84,184 KB
testcase_01 AC 121 ms
84,188 KB
testcase_02 AC 474 ms
107,136 KB
testcase_03 WA -
testcase_04 AC 350 ms
98,960 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 440 ms
106,620 KB
testcase_08 WA -
testcase_09 AC 423 ms
106,620 KB
testcase_10 AC 276 ms
102,652 KB
testcase_11 WA -
testcase_12 AC 250 ms
97,428 KB
testcase_13 AC 222 ms
95,068 KB
testcase_14 AC 215 ms
94,824 KB
testcase_15 AC 270 ms
102,184 KB
testcase_16 AC 248 ms
99,664 KB
testcase_17 AC 173 ms
90,144 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 477 ms
105,172 KB
testcase_22 AC 487 ms
105,776 KB
testcase_23 AC 397 ms
102,516 KB
testcase_24 AC 463 ms
103,104 KB
testcase_25 AC 483 ms
105,092 KB
testcase_26 AC 386 ms
103,316 KB
testcase_27 AC 350 ms
96,816 KB
testcase_28 AC 392 ms
106,576 KB
testcase_29 AC 339 ms
100,284 KB
testcase_30 AC 382 ms
102,840 KB
testcase_31 AC 493 ms
107,052 KB
testcase_32 WA -
testcase_33 AC 432 ms
102,984 KB
testcase_34 AC 278 ms
95,676 KB
testcase_35 AC 323 ms
97,204 KB
testcase_36 AC 424 ms
101,852 KB
testcase_37 AC 329 ms
101,072 KB
testcase_38 AC 224 ms
91,836 KB
testcase_39 AC 252 ms
98,780 KB
testcase_40 AC 251 ms
99,996 KB
testcase_41 AC 258 ms
104,500 KB
testcase_42 AC 256 ms
104,020 KB
testcase_43 AC 343 ms
107,400 KB
testcase_44 AC 344 ms
107,428 KB
testcase_45 AC 328 ms
107,420 KB
testcase_46 AC 325 ms
100,176 KB
testcase_47 AC 410 ms
103,052 KB
testcase_48 AC 398 ms
102,284 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*(N+1)+N),1))
    
    seen = [0]*(N+1)
    while len(Q) > 0:
        tmp,pos = heappop(Q)
        tmp = -tmp
        mx = tmp//(N+1)
        cnt = tmp%(N+1)-N
        cnt = -cnt
        
        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)*(N+1)+N-(cnt+1)),nx))
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
if __name__ == '__main__':
    main()
0