結果

問題 No.2261 Coffee
ユーザー tamatotamato
提出日時 2023-04-07 22:30:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,179 ms / 2,000 ms
コード長 752 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 103,360 KB
最終ジャッジ日時 2024-04-10 17:29:54
合計ジャッジ時間 26,931 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
53,120 KB
testcase_01 AC 33 ms
53,248 KB
testcase_02 AC 33 ms
52,548 KB
testcase_03 AC 33 ms
52,608 KB
testcase_04 AC 33 ms
52,992 KB
testcase_05 AC 38 ms
59,648 KB
testcase_06 AC 40 ms
61,696 KB
testcase_07 AC 33 ms
53,120 KB
testcase_08 AC 40 ms
62,336 KB
testcase_09 AC 43 ms
59,648 KB
testcase_10 AC 68 ms
76,692 KB
testcase_11 AC 69 ms
76,544 KB
testcase_12 AC 71 ms
76,928 KB
testcase_13 AC 67 ms
76,544 KB
testcase_14 AC 67 ms
76,820 KB
testcase_15 AC 64 ms
75,648 KB
testcase_16 AC 66 ms
76,720 KB
testcase_17 AC 121 ms
77,696 KB
testcase_18 AC 112 ms
77,696 KB
testcase_19 AC 110 ms
77,440 KB
testcase_20 AC 112 ms
77,304 KB
testcase_21 AC 127 ms
77,504 KB
testcase_22 AC 124 ms
77,440 KB
testcase_23 AC 124 ms
77,768 KB
testcase_24 AC 1,057 ms
101,704 KB
testcase_25 AC 935 ms
97,040 KB
testcase_26 AC 1,154 ms
102,800 KB
testcase_27 AC 1,066 ms
101,012 KB
testcase_28 AC 930 ms
99,236 KB
testcase_29 AC 906 ms
98,336 KB
testcase_30 AC 713 ms
92,840 KB
testcase_31 AC 1,011 ms
103,360 KB
testcase_32 AC 997 ms
102,984 KB
testcase_33 AC 1,066 ms
102,468 KB
testcase_34 AC 1,179 ms
102,592 KB
testcase_35 AC 1,101 ms
102,600 KB
testcase_36 AC 1,079 ms
102,464 KB
testcase_37 AC 1,064 ms
102,980 KB
testcase_38 AC 1,086 ms
102,504 KB
testcase_39 AC 1,080 ms
102,388 KB
testcase_40 AC 1,070 ms
102,520 KB
testcase_41 AC 1,112 ms
102,772 KB
testcase_42 AC 1,047 ms
102,776 KB
testcase_43 AC 1,084 ms
103,320 KB
testcase_44 AC 1,142 ms
102,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline


def dist(X, Y):
    return sum([abs(x - y) for x, y in zip(X, Y)])


N = int(input())
ABCDE = []
for _ in range(N):
    ABCDE.append(tuple(map(int, input().split())))

M = []
for i in range(32):
    X = []
    for j in range(5):
        if i >> j & 1:
            X.append(1)
        else:
            X.append(-1)
    ma = -float("inf")
    ma_idx = -1
    for k, line in enumerate(ABCDE):
        z = 0
        for j in range(5):
            z += line[j] * X[j]
        if z > ma:
            ma = z
            ma_idx = k
    M.append(ma_idx)


for i in range(N):
    line = ABCDE[i]
    ans = 0
    for j in range(len(M)):
        line2 = ABCDE[M[j]]
        ans = max(ans, dist(line, line2))
    print(ans)
0