結果
問題 | No.1473 おでぶなおばけさん |
ユーザー | buey_t |
提出日時 | 2023-03-26 10:48:53 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,319 bytes |
コンパイル時間 | 197 ms |
コンパイル使用メモリ | 82,776 KB |
実行使用メモリ | 118,536 KB |
最終ジャッジ日時 | 2024-09-19 09:37:18 |
合計ジャッジ時間 | 19,723 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 120 ms
85,160 KB |
testcase_01 | AC | 116 ms
84,916 KB |
testcase_02 | AC | 521 ms
114,964 KB |
testcase_03 | AC | 378 ms
111,524 KB |
testcase_04 | AC | 315 ms
103,120 KB |
testcase_05 | AC | 248 ms
93,420 KB |
testcase_06 | AC | 497 ms
111,748 KB |
testcase_07 | AC | 493 ms
114,996 KB |
testcase_08 | AC | 586 ms
115,132 KB |
testcase_09 | AC | 479 ms
115,620 KB |
testcase_10 | AC | 286 ms
100,448 KB |
testcase_11 | AC | 315 ms
100,620 KB |
testcase_12 | AC | 280 ms
100,472 KB |
testcase_13 | AC | 229 ms
96,876 KB |
testcase_14 | AC | 201 ms
94,068 KB |
testcase_15 | AC | 274 ms
100,596 KB |
testcase_16 | AC | 246 ms
99,052 KB |
testcase_17 | AC | 161 ms
90,192 KB |
testcase_18 | AC | 175 ms
90,696 KB |
testcase_19 | AC | 321 ms
100,724 KB |
testcase_20 | AC | 407 ms
108,768 KB |
testcase_21 | AC | 560 ms
106,468 KB |
testcase_22 | AC | 721 ms
114,952 KB |
testcase_23 | AC | 570 ms
109,760 KB |
testcase_24 | AC | 649 ms
110,676 KB |
testcase_25 | AC | 604 ms
112,476 KB |
testcase_26 | AC | 376 ms
112,556 KB |
testcase_27 | AC | 313 ms
98,104 KB |
testcase_28 | AC | 400 ms
118,536 KB |
testcase_29 | AC | 350 ms
108,524 KB |
testcase_30 | AC | 401 ms
111,472 KB |
testcase_31 | AC | 486 ms
115,256 KB |
testcase_32 | AC | 516 ms
112,568 KB |
testcase_33 | AC | 350 ms
109,820 KB |
testcase_34 | AC | 258 ms
101,120 KB |
testcase_35 | AC | 304 ms
100,812 KB |
testcase_36 | AC | 587 ms
110,776 KB |
testcase_37 | AC | 346 ms
110,880 KB |
testcase_38 | AC | 199 ms
91,256 KB |
testcase_39 | AC | 265 ms
99,084 KB |
testcase_40 | AC | 262 ms
99,216 KB |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | AC | 325 ms
109,892 KB |
testcase_44 | AC | 331 ms
109,936 KB |
testcase_45 | AC | 326 ms
110,032 KB |
testcase_46 | AC | 324 ms
110,040 KB |
testcase_47 | AC | 366 ms
114,888 KB |
testcase_48 | AC | 362 ms
108,588 KB |
ソースコード
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: r = m else: l = 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[l] and seen[nx] == 0: Q.append((nx,cnt+1)) print(w[l],ans) if __name__ == '__main__': main()