結果

問題 No.2315 Flying Camera
ユーザー mkawa2mkawa2
提出日時 2023-05-26 21:34:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 769 ms / 2,000 ms
コード長 959 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 78,804 KB
最終ジャッジ日時 2023-08-26 10:35:36
合計ジャッジ時間 12,430 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
77,512 KB
testcase_01 AC 139 ms
77,892 KB
testcase_02 AC 162 ms
78,500 KB
testcase_03 AC 479 ms
77,772 KB
testcase_04 AC 659 ms
78,016 KB
testcase_05 AC 573 ms
78,352 KB
testcase_06 AC 387 ms
78,728 KB
testcase_07 AC 700 ms
78,012 KB
testcase_08 AC 331 ms
77,984 KB
testcase_09 AC 192 ms
78,444 KB
testcase_10 AC 342 ms
78,136 KB
testcase_11 AC 690 ms
77,888 KB
testcase_12 AC 239 ms
78,272 KB
testcase_13 AC 176 ms
78,572 KB
testcase_14 AC 696 ms
77,876 KB
testcase_15 AC 536 ms
78,060 KB
testcase_16 AC 450 ms
78,804 KB
testcase_17 AC 321 ms
78,136 KB
testcase_18 AC 689 ms
77,928 KB
testcase_19 AC 527 ms
77,944 KB
testcase_20 AC 285 ms
77,780 KB
testcase_21 AC 406 ms
77,940 KB
testcase_22 AC 256 ms
78,008 KB
testcase_23 AC 109 ms
78,160 KB
testcase_24 AC 769 ms
78,280 KB
testcase_25 AC 112 ms
77,620 KB
testcase_26 AC 693 ms
77,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# md = 10**9+7
md = 998244353

def dist(x,y,i):
    s,t=xy[i]
    return abs(s-x)+abs(t-y)

n=II()
xy=LLI(n)

ans=inf
for x in range(1,301):
    for y in range(1,301):
        s=sum(dist(x,y,i) for i in range(n))
        if s<ans:ans=s

print(ans)
0