結果
問題 | No.2354 Poor Sight in Winter |
ユーザー | Navier_Boltzmann |
提出日時 | 2023-06-17 01:03:20 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,066 bytes |
コンパイル時間 | 358 ms |
コンパイル使用メモリ | 87,324 KB |
実行使用メモリ | 91,676 KB |
最終ジャッジ日時 | 2023-09-06 23:56:00 |
合計ジャッジ時間 | 8,364 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 99 ms
72,724 KB |
testcase_01 | AC | 101 ms
73,180 KB |
testcase_02 | AC | 99 ms
72,840 KB |
testcase_03 | WA | - |
testcase_04 | AC | 99 ms
72,740 KB |
testcase_05 | WA | - |
testcase_06 | AC | 97 ms
73,172 KB |
testcase_07 | AC | 99 ms
72,948 KB |
testcase_08 | AC | 101 ms
73,016 KB |
testcase_09 | AC | 110 ms
77,820 KB |
testcase_10 | AC | 108 ms
78,048 KB |
testcase_11 | AC | 337 ms
89,964 KB |
testcase_12 | AC | 313 ms
89,656 KB |
testcase_13 | AC | 447 ms
91,676 KB |
testcase_14 | AC | 456 ms
91,208 KB |
testcase_15 | AC | 424 ms
90,948 KB |
testcase_16 | AC | 413 ms
90,832 KB |
testcase_17 | AC | 422 ms
90,492 KB |
testcase_18 | AC | 290 ms
84,232 KB |
testcase_19 | AC | 364 ms
87,424 KB |
testcase_20 | AC | 314 ms
85,512 KB |
testcase_21 | AC | 179 ms
81,256 KB |
testcase_22 | AC | 257 ms
84,048 KB |
testcase_23 | AC | 258 ms
83,888 KB |
testcase_24 | AC | 330 ms
86,704 KB |
testcase_25 | WA | - |
testcase_26 | AC | 213 ms
82,128 KB |
testcase_27 | AC | 148 ms
80,088 KB |
testcase_28 | AC | 171 ms
80,268 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)