結果

問題 No.2261 Coffee
ユーザー tassei903tassei903
提出日時 2023-04-07 21:45:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,249 ms / 2,000 ms
コード長 913 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 94,640 KB
最終ジャッジ日時 2024-04-10 16:53:16
合計ジャッジ時間 26,469 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,992 KB
testcase_01 AC 37 ms
52,736 KB
testcase_02 AC 37 ms
52,352 KB
testcase_03 AC 36 ms
52,864 KB
testcase_04 AC 36 ms
53,120 KB
testcase_05 AC 42 ms
59,648 KB
testcase_06 AC 41 ms
59,904 KB
testcase_07 AC 37 ms
52,480 KB
testcase_08 AC 41 ms
60,544 KB
testcase_09 AC 41 ms
59,520 KB
testcase_10 AC 81 ms
76,888 KB
testcase_11 AC 86 ms
76,632 KB
testcase_12 AC 66 ms
71,296 KB
testcase_13 AC 63 ms
69,376 KB
testcase_14 AC 77 ms
76,624 KB
testcase_15 AC 55 ms
66,304 KB
testcase_16 AC 62 ms
69,376 KB
testcase_17 AC 263 ms
80,088 KB
testcase_18 AC 276 ms
79,812 KB
testcase_19 AC 255 ms
80,348 KB
testcase_20 AC 252 ms
80,296 KB
testcase_21 AC 267 ms
80,220 KB
testcase_22 AC 261 ms
80,336 KB
testcase_23 AC 270 ms
80,124 KB
testcase_24 AC 1,133 ms
92,656 KB
testcase_25 AC 1,024 ms
91,284 KB
testcase_26 AC 1,249 ms
93,956 KB
testcase_27 AC 1,187 ms
93,012 KB
testcase_28 AC 749 ms
92,044 KB
testcase_29 AC 722 ms
91,032 KB
testcase_30 AC 635 ms
88,676 KB
testcase_31 AC 787 ms
93,832 KB
testcase_32 AC 785 ms
94,024 KB
testcase_33 AC 790 ms
94,192 KB
testcase_34 AC 776 ms
94,320 KB
testcase_35 AC 880 ms
93,700 KB
testcase_36 AC 806 ms
93,792 KB
testcase_37 AC 803 ms
93,784 KB
testcase_38 AC 1,140 ms
94,640 KB
testcase_39 AC 1,194 ms
94,132 KB
testcase_40 AC 1,153 ms
94,196 KB
testcase_41 AC 1,157 ms
94,300 KB
testcase_42 AC 1,170 ms
94,392 KB
testcase_43 AC 1,191 ms
94,124 KB
testcase_44 AC 1,156 ms
94,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
inf = float("inf")
m = 5
n = ni()
a = [na() for i in range(n)]
dp = [-inf] * (1<<m)

for i in range(n):
    for j in range(1<<m):
        res = 0
        for k in range(m):
            if j >> k & 1:
                res += a[i][k]
            else:
                res -= a[i][k]
        dp[j] = max(dp[j], res * n + i)
def dist(p, q):
    return abs(p[0]-q[0])+abs(p[1]-q[1])+abs(p[2]-q[2])+abs(p[3]-q[3])+abs(p[4]-q[4])


for i in range(n):
    res = -inf
    for j in range(1<<m):
        c = dp[j]%n
        res = max(res, dist(a[i], a[c]))
    print(res)
0