結果

問題 No.2315 Flying Camera
ユーザー GrayCoderGrayCoder
提出日時 2023-05-26 22:04:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 509 ms / 2,000 ms
コード長 634 bytes
コンパイル時間 479 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 76,600 KB
最終ジャッジ日時 2023-08-26 11:38:52
合計ジャッジ時間 8,989 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,264 KB
testcase_01 AC 73 ms
71,284 KB
testcase_02 AC 83 ms
75,656 KB
testcase_03 AC 330 ms
75,888 KB
testcase_04 AC 443 ms
76,088 KB
testcase_05 AC 388 ms
75,796 KB
testcase_06 AC 237 ms
76,008 KB
testcase_07 AC 439 ms
75,972 KB
testcase_08 AC 198 ms
75,872 KB
testcase_09 AC 110 ms
76,128 KB
testcase_10 AC 202 ms
75,872 KB
testcase_11 AC 452 ms
76,020 KB
testcase_12 AC 136 ms
76,108 KB
testcase_13 AC 105 ms
76,112 KB
testcase_14 AC 471 ms
76,020 KB
testcase_15 AC 348 ms
76,184 KB
testcase_16 AC 287 ms
75,964 KB
testcase_17 AC 191 ms
75,996 KB
testcase_18 AC 463 ms
76,184 KB
testcase_19 AC 360 ms
75,944 KB
testcase_20 AC 167 ms
75,880 KB
testcase_21 AC 342 ms
76,600 KB
testcase_22 AC 157 ms
76,188 KB
testcase_23 AC 76 ms
71,060 KB
testcase_24 AC 509 ms
75,980 KB
testcase_25 AC 92 ms
76,032 KB
testcase_26 AC 487 ms
75,956 KB
権限があれば一括ダウンロードができます

ソースコード

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