結果

問題 No.2261 Coffee
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2023-04-07 22:46:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 437 ms / 2,000 ms
コード長 850 bytes
コンパイル時間 1,965 ms
コンパイル使用メモリ 195,716 KB
実行使用メモリ 53,196 KB
最終ジャッジ日時 2024-04-10 17:41:15
合計ジャッジ時間 11,985 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
50,768 KB
testcase_01 AC 9 ms
50,768 KB
testcase_02 AC 9 ms
50,772 KB
testcase_03 AC 9 ms
50,764 KB
testcase_04 AC 10 ms
50,768 KB
testcase_05 AC 9 ms
50,768 KB
testcase_06 AC 9 ms
50,640 KB
testcase_07 AC 9 ms
50,764 KB
testcase_08 AC 9 ms
50,896 KB
testcase_09 AC 9 ms
50,772 KB
testcase_10 AC 9 ms
50,764 KB
testcase_11 AC 10 ms
52,816 KB
testcase_12 AC 9 ms
50,768 KB
testcase_13 AC 10 ms
50,764 KB
testcase_14 AC 9 ms
50,896 KB
testcase_15 AC 9 ms
50,764 KB
testcase_16 AC 9 ms
50,644 KB
testcase_17 AC 22 ms
50,896 KB
testcase_18 AC 21 ms
52,688 KB
testcase_19 AC 20 ms
50,896 KB
testcase_20 AC 19 ms
52,812 KB
testcase_21 AC 21 ms
50,900 KB
testcase_22 AC 19 ms
50,768 KB
testcase_23 AC 22 ms
50,900 KB
testcase_24 AC 420 ms
51,796 KB
testcase_25 AC 339 ms
51,796 KB
testcase_26 AC 420 ms
51,924 KB
testcase_27 AC 401 ms
52,940 KB
testcase_28 AC 193 ms
51,668 KB
testcase_29 AC 190 ms
51,920 KB
testcase_30 AC 148 ms
51,664 KB
testcase_31 AC 249 ms
52,048 KB
testcase_32 AC 253 ms
52,176 KB
testcase_33 AC 246 ms
52,432 KB
testcase_34 AC 245 ms
52,176 KB
testcase_35 AC 245 ms
52,304 KB
testcase_36 AC 272 ms
52,056 KB
testcase_37 AC 264 ms
52,180 KB
testcase_38 AC 427 ms
52,428 KB
testcase_39 AC 418 ms
51,924 KB
testcase_40 AC 423 ms
52,052 KB
testcase_41 AC 420 ms
52,048 KB
testcase_42 AC 419 ms
52,052 KB
testcase_43 AC 437 ms
53,196 KB
testcase_44 AC 423 ms
52,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main () {
    int N;
    cin >> N;
    ll A[1 << 5][200020];
    ll B[1 << 5][2];
    for (int i = 0; i < N; i ++) {
        ll X[5];
        for (int j = 0; j < 5; j ++) {
            cin >> X[j];
        }
        for (int pk = 0; pk < (1 << 5); pk ++) {
            A[pk][i] = 0;
            for (int j = 0; j < 5; j ++) {
                A[pk][i] += X[j] * (((pk >> j) & 1) ? 1 : -1);
            }
        }
    }
    for (int i = 0; i < (1 << 5); i ++) {
        B[i][0] = *max_element(A[i], A[i] + N);
        B[i][1] = *min_element(A[i], A[i] + N);
    }
    for (int i = 0; i < N; i ++) {
        ll ans = 0;
        for (int j = 0; j < (1 << 5); j ++) {
            ans = max({ans, A[j][i] - B[j][1], B[j][0] - A[j][i]});
        }
        cout << ans << endl;
    }
}
0