結果

問題 No.2261 Coffee
ユーザー minimumminimum
提出日時 2023-04-07 22:10:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 705 ms / 2,000 ms
コード長 1,932 bytes
コンパイル時間 5,266 ms
コンパイル使用メモリ 266,764 KB
実行使用メモリ 13,928 KB
最終ジャッジ日時 2023-07-26 03:10:18
合計ジャッジ時間 22,365 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,356 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 3 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 16 ms
4,380 KB
testcase_18 AC 15 ms
4,380 KB
testcase_19 AC 14 ms
4,376 KB
testcase_20 AC 13 ms
4,380 KB
testcase_21 AC 16 ms
4,380 KB
testcase_22 AC 14 ms
4,380 KB
testcase_23 AC 17 ms
4,380 KB
testcase_24 AC 643 ms
13,292 KB
testcase_25 AC 547 ms
12,068 KB
testcase_26 AC 682 ms
13,808 KB
testcase_27 AC 635 ms
12,912 KB
testcase_28 AC 591 ms
12,436 KB
testcase_29 AC 573 ms
12,212 KB
testcase_30 AC 428 ms
9,636 KB
testcase_31 AC 698 ms
13,896 KB
testcase_32 AC 705 ms
13,752 KB
testcase_33 AC 686 ms
13,928 KB
testcase_34 AC 703 ms
13,748 KB
testcase_35 AC 698 ms
13,900 KB
testcase_36 AC 698 ms
13,832 KB
testcase_37 AC 696 ms
13,848 KB
testcase_38 AC 690 ms
13,752 KB
testcase_39 AC 693 ms
13,752 KB
testcase_40 AC 693 ms
13,856 KB
testcase_41 AC 696 ms
13,752 KB
testcase_42 AC 688 ms
13,852 KB
testcase_43 AC 689 ms
13,748 KB
testcase_44 AC 684 ms
13,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

typedef long long ll;
typedef modint998244353 mint;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<mint> vm;
typedef vector<vm> vvm;
typedef vector<char> vc;
typedef vector<char> vvc;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<bool> vb;
typedef vector<vb> vvb;

typedef pair<int, int> pii;
typedef pair<int, pii> ppii;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> ppll;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP_(i, s, t) for (int i = s, i##_len=(t); i<i##_len; ++i)
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)x.size()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

constexpr int MOD = 998244353;
constexpr int inf = 1001001001;
constexpr ll INF = 1001001001001001001;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
    
    int N;
    cin >> N;
    vvl A(N, vl(5));
    REP(i, N) REP(j, 5){
        cin >> A[i][j];
    }
    vi ls;
    REP(i, 1 << 5) {
        vector<pll> tmp;
        REP(j, N) {
            ll s = 0;
            REP(k, 5){
                if (((i >> k) & 1) == 0){
                    s += A[j][k];
                } else {
                    s -= A[j][k];
                }
            }
            tmp.emplace_back(s, j);
        }
        sort(ALL(tmp));
        ls.emplace_back(tmp[0].second);
        ls.emplace_back(tmp[N - 1].second);
    }

    REP(k, N){
        ll ans = 0;
        REP(i, 64){
            ll s = 0;
            REP(j, 5){
                s += abs(A[k][j] - A[ls[i]][j]);
            }
            ans = max(ans, s);
        }
        cout << ans << endl;
    }
    return 0;
}
0