結果

問題 No.2354 Poor Sight in Winter
ユーザー shogo314shogo314
提出日時 2023-06-17 10:37:55
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 851 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 86,164 KB
最終ジャッジ日時 2023-09-07 07:56:29
合計ジャッジ時間 5,881 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,188 KB
testcase_01 AC 75 ms
71,180 KB
testcase_02 AC 75 ms
70,924 KB
testcase_03 AC 74 ms
70,920 KB
testcase_04 AC 73 ms
71,368 KB
testcase_05 AC 72 ms
71,364 KB
testcase_06 AC 73 ms
71,132 KB
testcase_07 AC 72 ms
71,292 KB
testcase_08 AC 74 ms
71,140 KB
testcase_09 AC 95 ms
75,964 KB
testcase_10 AC 107 ms
76,924 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
sx, sy, gx, gy = map(int, input().split())
xy = [(sx, sy), (gx, gy)]+[tuple(map(int, input().split())) for i in range(N)]
N += 2
ans_min = 0
ans_max = 2*10**5


def dis(i, j):
    return abs(xy[i][0]-xy[j][0])+abs(xy[i][1]-xy[j][1])


while ans_max-ans_min > 1:
    ans_mid = (ans_max+ans_min)//2
    tmp = [[(dis(i, j)-1)//ans_mid if i != j else 0 for j in range(N)]
           for i in range(N)]
    for k in range(N):
        for i in range(N-1):
            if i == k:
                continue
            for j in range(i+1, N):
                if j == k:
                    continue
                tmp[i][j] = min(tmp[i][j], tmp[i][k]+tmp[k][j])
                tmp[j][i] = min(tmp[j][i], tmp[j][k]+tmp[k][i])
    if tmp[0][1] <= K:
        ans_max = ans_mid
    else:
        ans_min = ans_mid
print(ans_max)
0