結果

問題 No.2261 Coffee
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-04-07 22:14:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,535 ms / 2,000 ms
コード長 871 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 100,676 KB
最終ジャッジ日時 2024-04-10 17:16:29
合計ジャッジ時間 34,125 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,992 KB
testcase_01 AC 44 ms
59,776 KB
testcase_02 AC 38 ms
52,864 KB
testcase_03 AC 39 ms
52,352 KB
testcase_04 AC 45 ms
60,032 KB
testcase_05 AC 48 ms
61,952 KB
testcase_06 AC 49 ms
62,976 KB
testcase_07 AC 44 ms
59,392 KB
testcase_08 AC 49 ms
62,336 KB
testcase_09 AC 49 ms
62,080 KB
testcase_10 AC 59 ms
66,688 KB
testcase_11 AC 59 ms
66,816 KB
testcase_12 AC 61 ms
66,304 KB
testcase_13 AC 57 ms
65,408 KB
testcase_14 AC 60 ms
66,432 KB
testcase_15 AC 60 ms
65,920 KB
testcase_16 AC 55 ms
65,408 KB
testcase_17 AC 120 ms
77,568 KB
testcase_18 AC 118 ms
77,184 KB
testcase_19 AC 110 ms
77,164 KB
testcase_20 AC 106 ms
76,924 KB
testcase_21 AC 117 ms
76,988 KB
testcase_22 AC 106 ms
77,056 KB
testcase_23 AC 116 ms
77,736 KB
testcase_24 AC 1,415 ms
99,000 KB
testcase_25 AC 1,300 ms
95,068 KB
testcase_26 AC 1,535 ms
100,504 KB
testcase_27 AC 1,415 ms
99,128 KB
testcase_28 AC 1,181 ms
96,200 KB
testcase_29 AC 1,297 ms
95,984 KB
testcase_30 AC 928 ms
91,036 KB
testcase_31 AC 1,323 ms
99,888 KB
testcase_32 AC 1,319 ms
100,500 KB
testcase_33 AC 1,320 ms
99,984 KB
testcase_34 AC 1,369 ms
99,860 KB
testcase_35 AC 1,379 ms
100,116 KB
testcase_36 AC 1,354 ms
100,236 KB
testcase_37 AC 1,435 ms
100,272 KB
testcase_38 AC 1,502 ms
100,152 KB
testcase_39 AC 1,426 ms
100,616 KB
testcase_40 AC 1,490 ms
100,288 KB
testcase_41 AC 1,444 ms
100,676 KB
testcase_42 AC 1,481 ms
100,420 KB
testcase_43 AC 1,471 ms
100,120 KB
testcase_44 AC 1,451 ms
100,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from sys import stdin

inf = float("inf")

N = int(stdin.readline())

bits = [ [(inf,inf)] * (2**5) for i in range(2) ]

points = []

for i in range(N):

    A = list(map(int,stdin.readline().split()))
    points.append(A)
    
    for j in range(2**5):

        x = 0

        for k in range(5):

            if 2**k & j:
                x += A[k]
            else:
                x -= A[k]

        tup = (x,i)

        if bits[0][j] > tup:
            bits[1][j] = bits[0][j]
            bits[0][j] = tup
        elif bits[1][j] > tup:
            bits[1][j] = tup
        #bits[j] = min(bits[j] , (x , i) )

ans = [-inf] * N

#print (bits)

for i in range(N):

    for _,j in bits[0]+bits[1]:

        now = 0

        for k in range(5):

            now += abs(points[i][k] - points[j][k])
    
        ans[i] = max(ans[i] , now)

print (*ans,sep="\n")
0