結果
問題 | No.1473 おでぶなおばけさん |
ユーザー | 👑 timi |
提出日時 | 2021-04-26 17:00:28 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,098 bytes |
コンパイル時間 | 294 ms |
コンパイル使用メモリ | 87,056 KB |
実行使用メモリ | 132,172 KB |
最終ジャッジ日時 | 2023-09-18 11:28:53 |
合計ジャッジ時間 | 27,040 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 94 ms
71,336 KB |
testcase_01 | AC | 91 ms
71,360 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 923 ms
130,028 KB |
testcase_08 | AC | 902 ms
128,308 KB |
testcase_09 | AC | 901 ms
132,172 KB |
testcase_10 | AC | 416 ms
91,864 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 273 ms
86,376 KB |
testcase_14 | AC | 230 ms
85,948 KB |
testcase_15 | AC | 367 ms
93,424 KB |
testcase_16 | AC | 377 ms
91,436 KB |
testcase_17 | AC | 119 ms
78,884 KB |
testcase_18 | AC | 133 ms
80,176 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 867 ms
128,312 KB |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | TLE | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | TLE | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | AC | 387 ms
91,796 KB |
testcase_42 | AC | 390 ms
91,588 KB |
testcase_43 | AC | 255 ms
103,808 KB |
testcase_44 | AC | 259 ms
103,948 KB |
testcase_45 | AC | 257 ms
103,592 KB |
testcase_46 | AC | 793 ms
114,948 KB |
testcase_47 | AC | 824 ms
118,544 KB |
testcase_48 | AC | 780 ms
114,344 KB |
ソースコード
import sys input=sys.stdin.readline sys.setrecursionlimit(10**7) 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=0 for d,s,t in D: #print(s,t,d,limit) 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)) F=[N]*N while d: now,pre,num=d.popleft() for nex in E[now]: if nex==N-1: print(answ,num+1) exit() if nex!=pre: if num+1<F[nex]: F[nex]=num d.appendleft((nex,now,num+1))