結果
問題 | No.2354 Poor Sight in Winter |
ユーザー | Navier_Boltzmann |
提出日時 | 2023-06-16 22:26:45 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,066 bytes |
コンパイル時間 | 930 ms |
コンパイル使用メモリ | 86,844 KB |
実行使用メモリ | 91,224 KB |
最終ジャッジ日時 | 2023-09-06 20:41:28 |
合計ジャッジ時間 | 9,124 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 106 ms
72,544 KB |
testcase_01 | AC | 103 ms
72,596 KB |
testcase_02 | AC | 105 ms
72,596 KB |
testcase_03 | WA | - |
testcase_04 | AC | 105 ms
72,548 KB |
testcase_05 | WA | - |
testcase_06 | AC | 105 ms
72,536 KB |
testcase_07 | AC | 105 ms
72,384 KB |
testcase_08 | AC | 104 ms
72,616 KB |
testcase_09 | AC | 115 ms
77,320 KB |
testcase_10 | AC | 117 ms
77,312 KB |
testcase_11 | AC | 349 ms
89,412 KB |
testcase_12 | AC | 318 ms
89,268 KB |
testcase_13 | AC | 459 ms
91,224 KB |
testcase_14 | AC | 468 ms
90,732 KB |
testcase_15 | AC | 426 ms
90,248 KB |
testcase_16 | AC | 418 ms
90,292 KB |
testcase_17 | AC | 432 ms
89,868 KB |
testcase_18 | AC | 293 ms
83,788 KB |
testcase_19 | AC | 374 ms
87,080 KB |
testcase_20 | AC | 315 ms
84,824 KB |
testcase_21 | AC | 191 ms
80,700 KB |
testcase_22 | AC | 275 ms
83,440 KB |
testcase_23 | AC | 271 ms
83,464 KB |
testcase_24 | AC | 337 ms
86,344 KB |
testcase_25 | WA | - |
testcase_26 | AC | 224 ms
81,476 KB |
testcase_27 | AC | 159 ms
79,608 KB |
testcase_28 | AC | 181 ms
79,892 KB |
ソースコード
from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline N,K = map(int,input().split()) sx,sy,gx,gy = map(int,input().split()) xy = [tuple(map(int,input().split())) for _ in range(N)] xy = [(sx,sy)] + xy + [(gx,gy)] e = [[] for _ in range(N+2)] for i in range(N+1): xi,yi = xy[i] for j in range(i+1,N+2): xj,yj = xy[j] d = abs(xi-xj)+abs(yi-yj) e[i].append((j,d)) e[j].append((i,d)) INF = (1<<30) def dijkstra(s,e,k): N = len(e) dist = [INF]*N dist[s]=0 h = [] heappush(h,(0,s)) while h: nw,v = heappop(h) if dist[v]!=nw: continue for iv,ic in e[v]: nc = (ic-1)//k + nw if nc < dist[iv]: dist[iv] = nc heappush(h,(nc,iv)) return dist def is_ok(k): return dijkstra(0,e,k)[N+1]<=K x = 1 y = 10**7 while y-x>1: mid = (y+x)//2 if is_ok(mid): y = mid else: x = mid print(y)