結果

問題 No.2261 Coffee
ユーザー jianglyjiangly
提出日時 2023-04-07 21:27:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 943 bytes
コンパイル時間 2,005 ms
コンパイル使用メモリ 199,480 KB
実行使用メモリ 7,264 KB
最終ジャッジ日時 2024-04-10 16:35:48
合計ジャッジ時間 7,152 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 5 ms
6,944 KB
testcase_18 AC 5 ms
6,940 KB
testcase_19 AC 4 ms
6,944 KB
testcase_20 AC 4 ms
6,944 KB
testcase_21 AC 6 ms
6,944 KB
testcase_22 AC 4 ms
6,944 KB
testcase_23 AC 6 ms
6,940 KB
testcase_24 AC 127 ms
6,940 KB
testcase_25 AC 109 ms
6,940 KB
testcase_26 AC 135 ms
7,084 KB
testcase_27 AC 130 ms
6,944 KB
testcase_28 AC 73 ms
6,944 KB
testcase_29 AC 72 ms
6,944 KB
testcase_30 AC 56 ms
6,940 KB
testcase_31 AC 92 ms
7,136 KB
testcase_32 AC 90 ms
7,136 KB
testcase_33 AC 89 ms
7,216 KB
testcase_34 AC 88 ms
7,244 KB
testcase_35 AC 89 ms
7,108 KB
testcase_36 AC 90 ms
7,200 KB
testcase_37 AC 88 ms
7,264 KB
testcase_38 AC 138 ms
6,996 KB
testcase_39 AC 138 ms
7,136 KB
testcase_40 AC 134 ms
7,120 KB
testcase_41 AC 137 ms
7,108 KB
testcase_42 AC 137 ms
7,124 KB
testcase_43 AC 136 ms
7,176 KB
testcase_44 AC 136 ms
7,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using i64 = long long;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int N;
    std::cin >> N;
    
    std::vector<std::array<i64, 5>> A(N);
    std::vector<i64> max(32, -1E18);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 5; j++) {
            std::cin >> A[i][j];
        }
        for (int s = 0; s < 32; s++) {
            i64 v = 0;
            for (int j = 0; j < 5; j++) {
                v += (s >> j & 1 ? 1 : -1) * A[i][j];
            }
            max[s] = std::max(max[s], v);
        }
    }
    for (int i = 0; i < N; i++) {
        i64 ans = -1E18;
        for (int s = 0; s < 32; s++) {
            i64 v = 0;
            for (int j = 0; j < 5; j++) {
                v += (s >> j & 1 ? 1 : -1) * A[i][j];
            }
            ans = std::max(ans, v + max[s ^ 31]);
        }
        std::cout << ans << "\n";
    }
    
    return 0;
}
0