結果
問題 | No.807 umg tours |
ユーザー |
![]() |
提出日時 | 2023-03-19 13:13:12 |
言語 | PyPy3 (7.3.8) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,844 bytes |
コンパイル時間 | 288 ms |
使用メモリ | 179,904 KB |
最終ジャッジ日時 | 2023-03-19 13:13:43 |
合計ジャッジ時間 | 12,279 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 260 ms
90,400 KB |
testcase_01 | AC | 262 ms
90,760 KB |
testcase_02 | AC | 284 ms
90,828 KB |
testcase_03 | AC | 288 ms
90,988 KB |
testcase_04 | AC | 278 ms
90,656 KB |
testcase_05 | AC | 263 ms
90,800 KB |
testcase_06 | AC | 286 ms
91,588 KB |
testcase_07 | AC | 275 ms
90,852 KB |
testcase_08 | AC | 238 ms
88,632 KB |
testcase_09 | AC | 261 ms
90,364 KB |
testcase_10 | AC | 249 ms
90,380 KB |
testcase_11 | TLE | - |
testcase_12 | AC | 2,818 ms
141,144 KB |
testcase_13 | TLE | - |
testcase_14 | AC | 1,786 ms
121,408 KB |
testcase_15 | AC | 1,426 ms
114,524 KB |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
ソースコード
def main(): try: import pypyjit pypyjit.set_param('max_unroll_recursion=-1') except: pass try: import sys sys.setrecursionlimit(10**7) except: pass 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 ''' ''' N,M = map(int, input().split()) G = [[] for _ in range(N+1)] for _ in range(M): a,b,c = map(int, input().split()) G[a].append((b,c)) G[b].append((a,c)) Q = [] heappush(Q,(0,1,0)) dis = [[INF]*2 for _ in range(N+1)] while len(Q) > 0: cnt,pos,f = heappop(Q) if dis[pos][f] != INF: continue dis[pos][f] = cnt for nx,d in G[pos]: if dis[nx][f] == INF: heappush(Q,(cnt+d,nx,f)) if f == 0: heappush(Q,(cnt,nx,1)) for i in range(1,N+1): print(dis[i][0]+min(dis[i][0],dis[i][1])) if __name__ == '__main__': main()