結果

問題 No.2261 Coffee
ユーザー eve__fuyukieve__fuyuki
提出日時 2024-01-22 18:04:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 266 ms / 2,000 ms
コード長 1,141 bytes
コンパイル時間 2,521 ms
コンパイル使用メモリ 207,532 KB
実行使用メモリ 26,624 KB
最終ジャッジ日時 2024-01-22 18:04:14
合計ジャッジ時間 13,370 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 9 ms
6,676 KB
testcase_18 AC 8 ms
6,676 KB
testcase_19 AC 7 ms
6,676 KB
testcase_20 AC 7 ms
6,676 KB
testcase_21 AC 9 ms
6,676 KB
testcase_22 AC 7 ms
6,676 KB
testcase_23 AC 9 ms
6,676 KB
testcase_24 AC 227 ms
24,960 KB
testcase_25 AC 196 ms
21,888 KB
testcase_26 AC 241 ms
26,496 KB
testcase_27 AC 223 ms
24,704 KB
testcase_28 AC 166 ms
22,784 KB
testcase_29 AC 161 ms
22,400 KB
testcase_30 AC 127 ms
18,176 KB
testcase_31 AC 200 ms
26,624 KB
testcase_32 AC 198 ms
26,624 KB
testcase_33 AC 198 ms
26,624 KB
testcase_34 AC 222 ms
26,624 KB
testcase_35 AC 198 ms
26,624 KB
testcase_36 AC 198 ms
26,624 KB
testcase_37 AC 200 ms
26,624 KB
testcase_38 AC 242 ms
26,624 KB
testcase_39 AC 266 ms
26,624 KB
testcase_40 AC 242 ms
26,624 KB
testcase_41 AC 245 ms
26,624 KB
testcase_42 AC 246 ms
26,624 KB
testcase_43 AC 241 ms
26,624 KB
testcase_44 AC 243 ms
26,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
void fast_io() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

int main() {
    fast_io();
    int n;
    cin >> n;
    vector<vector<long long>> a(n, vector<long long>(5));
    vector<vector<long long>> b(n, vector<long long>(16));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 5; ++j) {
            cin >> a[i][j];
        }
        for (int k = 0; k < 16; k++) {
            for (int j = 0; j < 4; j++) {
                if (k & (1 << j)) {
                    b[i][k] += a[i][j];
                } else {
                    b[i][k] -= a[i][j];
                }
            }
            b[i][k] += a[i][4];
        }
    }
    vector<long long> ma(16, -1e18), mi(16, 1e18);
    for (int i = 0; i < n; ++i) {
        for (int k = 0; k < 16; ++k) {
            ma[k] = max(ma[k], b[i][k]);
            mi[k] = min(mi[k], b[i][k]);
        }
    }
    for (int i = 0; i < n; i++) {
        long long ans = 0;
        for (int k = 0; k < 16; k++) {
            ans = max({ans, ma[k] - b[i][k], b[i][k] - mi[k]});
        }
        cout << ans << endl;
    }
}
0