結果

問題 No.2315 Flying Camera
ユーザー GrayCoderGrayCoder
提出日時 2023-05-26 22:03:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 634 bytes
コンパイル時間 598 ms
コンパイル使用メモリ 10,776 KB
実行使用メモリ 12,692 KB
最終ジャッジ日時 2023-08-26 11:37:53
合計ジャッジ時間 6,149 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,764 KB
testcase_01 AC 16 ms
7,764 KB
testcase_02 AC 17 ms
7,952 KB
testcase_03 TLE -
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


def main():
    sys.setrecursionlimit(1000000)
    input = lambda: sys.stdin.readline()[:-1]
    N = int(input())
    XY = [tuple(map(int, input().split())) for _ in [0] * N]

    x1, x2, y1, y2 = 300, 0, 300, 0
    for x, y in XY:
        x1, x2 = min(x1, x), max(x2, x)
        y1, y2 = min(y1, y), max(y2, y)

    ans = float("inf")
    for x in range(x1, x2 + 1):
        for y in range(y1, y2 + 1):
            d = 0
            for xi, yi in XY:
                d += abs(xi - x) + abs(yi - y)
            ans = min(ans, d)
    print(ans)


if not __debug__:
    f = open(sys.argv[1], "r")
    sys.stdin = f

main()
0