結果

問題 No.2261 Coffee
ユーザー 👑 NachiaNachia
提出日時 2023-04-08 16:39:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 1,137 bytes
コンパイル時間 923 ms
コンパイル使用メモリ 83,624 KB
実行使用メモリ 7,224 KB
最終ジャッジ日時 2024-04-14 13:44:03
合計ジャッジ時間 6,575 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 6 ms
6,940 KB
testcase_18 AC 5 ms
6,940 KB
testcase_19 AC 5 ms
6,944 KB
testcase_20 AC 4 ms
6,940 KB
testcase_21 AC 5 ms
6,940 KB
testcase_22 AC 4 ms
6,940 KB
testcase_23 AC 6 ms
6,940 KB
testcase_24 AC 127 ms
6,944 KB
testcase_25 AC 110 ms
6,940 KB
testcase_26 AC 135 ms
7,140 KB
testcase_27 AC 125 ms
6,940 KB
testcase_28 AC 66 ms
6,940 KB
testcase_29 AC 63 ms
6,940 KB
testcase_30 AC 51 ms
6,944 KB
testcase_31 AC 82 ms
6,996 KB
testcase_32 AC 82 ms
7,108 KB
testcase_33 AC 83 ms
7,068 KB
testcase_34 AC 83 ms
7,168 KB
testcase_35 AC 82 ms
7,224 KB
testcase_36 AC 82 ms
7,196 KB
testcase_37 AC 83 ms
7,212 KB
testcase_38 AC 136 ms
7,180 KB
testcase_39 AC 136 ms
7,116 KB
testcase_40 AC 136 ms
7,180 KB
testcase_41 AC 137 ms
7,060 KB
testcase_42 AC 136 ms
7,168 KB
testcase_43 AC 135 ms
7,064 KB
testcase_44 AC 135 ms
7,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <atcoder/modint>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
const i64 INF = 1001001001001001001;

using Modint = atcoder::static_modint<998244353>;

int main(){
    int N; cin >> N;
    vector<i64> L(32, INF);
    vector<i64> R(32, -INF);
    vector<array<i64,5>> A(N);
    rep(i,N) rep(j,5) cin >> A[i][j];
    rep(i,N){
        rep(b,32){
            i64 buf = 0;
            rep(t,5) buf += A[i][t] * ((b&(1<<t)) ? 1 : -1);
            L[b] = min(L[b], buf);
            R[b] = max(R[b], buf);
        }
    }
    rep(i,N){
        i64 ans = 0;
        rep(b,32){
            i64 a = 0;
            rep(t,5) a += A[i][t] * ((b&(1<<t)) ? 1 : -1);
            ans = max(ans, max(R[b] - a, a - L[b]));
        }
        cout << ans << '\n';
    }
    return 0;
}



struct ios_do_not_sync{
    ios_do_not_sync(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    }
} ios_do_not_sync_instance;

0