結果
問題 | No.1473 おでぶなおばけさん |
ユーザー | 👑 timi |
提出日時 | 2021-04-26 16:00:06 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 960 bytes |
コンパイル時間 | 541 ms |
コンパイル使用メモリ | 86,836 KB |
実行使用メモリ | 546,436 KB |
最終ジャッジ日時 | 2023-09-18 08:56:58 |
合計ジャッジ時間 | 33,251 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
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 | 766 ms
113,700 KB |
testcase_23 | AC | 727 ms
112,096 KB |
testcase_24 | AC | 746 ms
111,116 KB |
testcase_25 | AC | 851 ms
112,472 KB |
testcase_26 | AC | 872 ms
115,676 KB |
testcase_27 | AC | 357 ms
87,868 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 | 621 ms
126,448 KB |
testcase_37 | AC | 648 ms
109,760 KB |
testcase_38 | AC | 254 ms
82,376 KB |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | MLE | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
ソースコード
N,M=map(int, input().split()) D=[] for i in range(M): s,t,d=map(int, input().split()) D.append((d,s,t)) D=sorted(D)[::-1] par=[i for i in range(N)] rank=[0]*(N) friend=[0]*N block=[0]*N size=[1]*N def find(x): if par[x]==x: return x else: par[x]=find(par[x]) return par[x] #同じ集合か判定 def same(x,y): return find(x)==find(y) def union(x,y): x=find(x) y=find(y) if x==y: return if rank[x]>rank[y]: par[y]=x size[x]+=size[y] else: par[x]=y size[y]+=size[x] if rank[x]==rank[y]: rank[y]+=1 E=[[]for i in range(N)] limit=10**10 for d,s,t in D: if limit<d: break s-=1 t-=1 union(s,t) E[s].append(t) E[t].append(s) if same(0,N-1): answ=d limit=d from collections import deque d=deque() d.append((0,0,0)) while d: now,pre,num=d.popleft() for nex in E[now]: if nex==N-1: print(answ,num+1) exit() if nex!=pre: d.append((nex,now,num+1))