結果

問題 No.2261 Coffee
ユーザー lloyzlloyz
提出日時 2023-04-14 20:27:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 743 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 90,752 KB
最終ジャッジ日時 2024-04-18 18:00:31
合計ジャッジ時間 20,014 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
52,224 KB
testcase_01 AC 35 ms
52,608 KB
testcase_02 AC 36 ms
52,864 KB
testcase_03 AC 38 ms
52,224 KB
testcase_04 AC 34 ms
52,736 KB
testcase_05 AC 44 ms
59,776 KB
testcase_06 AC 44 ms
61,184 KB
testcase_07 AC 35 ms
52,864 KB
testcase_08 AC 48 ms
61,056 KB
testcase_09 AC 40 ms
60,160 KB
testcase_10 AC 54 ms
66,048 KB
testcase_11 AC 54 ms
65,920 KB
testcase_12 AC 48 ms
65,024 KB
testcase_13 AC 48 ms
63,744 KB
testcase_14 AC 52 ms
65,664 KB
testcase_15 AC 47 ms
64,512 KB
testcase_16 AC 47 ms
64,548 KB
testcase_17 AC 96 ms
76,928 KB
testcase_18 AC 108 ms
76,928 KB
testcase_19 AC 102 ms
77,244 KB
testcase_20 AC 93 ms
76,952 KB
testcase_21 AC 98 ms
76,636 KB
testcase_22 AC 93 ms
76,928 KB
testcase_23 AC 102 ms
76,636 KB
testcase_24 AC 627 ms
89,056 KB
testcase_25 AC 560 ms
88,060 KB
testcase_26 AC 726 ms
90,496 KB
testcase_27 AC 674 ms
89,216 KB
testcase_28 AC 567 ms
88,576 KB
testcase_29 AC 556 ms
87,840 KB
testcase_30 AC 439 ms
85,656 KB
testcase_31 AC 635 ms
90,624 KB
testcase_32 AC 642 ms
90,332 KB
testcase_33 AC 628 ms
90,532 KB
testcase_34 AC 641 ms
90,624 KB
testcase_35 AC 688 ms
90,624 KB
testcase_36 AC 635 ms
90,676 KB
testcase_37 AC 626 ms
90,752 KB
testcase_38 AC 680 ms
89,972 KB
testcase_39 AC 743 ms
90,684 KB
testcase_40 AC 689 ms
90,272 KB
testcase_41 AC 689 ms
90,624 KB
testcase_42 AC 677 ms
90,240 KB
testcase_43 AC 719 ms
89,960 KB
testcase_44 AC 733 ms
90,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
P = [list(map(int, input().split())) for _ in range(n)]

INF = 10**16
Max = [-INF for _ in range(1 << 5)]
Min = [INF for _ in range(1 << 5)]
for i in range(n):
    for bit in range(1 << 5):
        tmp = 0
        for j in range(5):
            if (bit >> j) & 1:
                tmp += P[i][j]
            else:
                tmp -= P[i][j]
        if tmp > Max[bit]:
            Max[bit] = tmp
        if tmp < Min[bit]:
            Min[bit] = tmp
for i in range(n):
    ans = 0
    for bit in range(1 << 5):
        tmp = 0
        for j in range(5):
            if (bit >> j) & 1:
                tmp += P[i][j]
            else:
                tmp -= P[i][j]
        res = abs(Max[bit] - tmp)
        if res > ans:
            ans = res
        res = abs(Min[bit] - tmp)
        if res > ans:
            ans = res
    print(ans)

0