結果
問題 | No.614 壊れたキャンパス |
ユーザー | Mr.Fuku |
提出日時 | 2018-08-03 21:23:30 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 966 bytes |
コンパイル時間 | 96 ms |
コンパイル使用メモリ | 11,956 KB |
実行使用メモリ | 95,876 KB |
最終ジャッジ日時 | 2023-10-19 21:25:15 |
合計ジャッジ時間 | 10,889 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
14,640 KB |
testcase_01 | AC | 29 ms
10,204 KB |
testcase_02 | AC | 29 ms
10,204 KB |
testcase_03 | WA | - |
testcase_04 | AC | 30 ms
10,204 KB |
testcase_05 | AC | 30 ms
10,204 KB |
testcase_06 | AC | 29 ms
10,204 KB |
testcase_07 | WA | - |
testcase_08 | TLE | - |
testcase_09 | AC | 1,904 ms
95,876 KB |
testcase_10 | AC | 1,328 ms
56,372 KB |
testcase_11 | TLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
ソースコード
N,M,K,S,T = map(int,input().split()) roka = [] from_list = [[S,0]] to_list = [] ans = -1 def calc(from_list,to_list): next_list = [] for to in to_list: tmp_n = [to[1],float("inf")] for frm in from_list: step = abs(to[0]-frm[0])+frm[1] if tmp_n[1]>step: tmp_n[1]=step next_list.append(tmp_n[:]) return next_list[:] for i in range(M): roka.append(list(map(int,input().split()))) roka.sort() now_buil = 1 for rk in roka: if rk[0]==now_buil: to_list.append(rk[1:]) else: now_buil+=1 if rk[0]>now_buil: break else: from_list = calc(from_list,to_list) to_list = [rk[1:]] else: if now_buil+1 == N and M != 0: from_list = calc(from_list,to_list) ans = float("inf") for frm in from_list: step = abs(T-frm[0])+frm[1] if ans>step: ans=step print(ans)