結果
問題 | No.2315 Flying Camera |
ユーザー |
|
提出日時 | 2023-05-26 22:04:36 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 479 ms / 2,000 ms |
コード長 | 634 bytes |
コンパイル時間 | 335 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 75,648 KB |
最終ジャッジ日時 | 2024-12-25 07:04:20 |
合計ジャッジ時間 | 7,675 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
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()