結果

問題 No.2261 Coffee
ユーザー HaaHaa
提出日時 2023-04-07 21:35:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 710 ms / 2,000 ms
コード長 1,113 bytes
コンパイル時間 2,195 ms
コンパイル使用メモリ 175,584 KB
実行使用メモリ 12,100 KB
最終ジャッジ日時 2024-04-10 16:42:29
合計ジャッジ時間 17,494 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 1 ms
6,940 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,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 18 ms
6,944 KB
testcase_18 AC 17 ms
6,940 KB
testcase_19 AC 15 ms
6,944 KB
testcase_20 AC 13 ms
6,940 KB
testcase_21 AC 18 ms
6,940 KB
testcase_22 AC 14 ms
6,940 KB
testcase_23 AC 19 ms
6,944 KB
testcase_24 AC 640 ms
11,340 KB
testcase_25 AC 548 ms
10,112 KB
testcase_26 AC 684 ms
11,784 KB
testcase_27 AC 624 ms
11,136 KB
testcase_28 AC 474 ms
10,428 KB
testcase_29 AC 457 ms
10,240 KB
testcase_30 AC 351 ms
8,704 KB
testcase_31 AC 587 ms
11,840 KB
testcase_32 AC 570 ms
11,964 KB
testcase_33 AC 569 ms
11,964 KB
testcase_34 AC 580 ms
11,840 KB
testcase_35 AC 576 ms
11,840 KB
testcase_36 AC 570 ms
12,100 KB
testcase_37 AC 577 ms
11,972 KB
testcase_38 AC 683 ms
11,964 KB
testcase_39 AC 680 ms
11,968 KB
testcase_40 AC 687 ms
12,096 KB
testcase_41 AC 677 ms
11,836 KB
testcase_42 AC 710 ms
11,844 KB
testcase_43 AC 696 ms
11,972 KB
testcase_44 AC 692 ms
11,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
template<typename T> bool chmax(T& x, const T& y){return (x<y)?(x=y,true):false;};
template<typename T> bool chmin(T& x, const T& y){return (x>y)?(x=y,true):false;};
constexpr ll MOD=998244353;
constexpr ll INF=2e18;
 
int main(){
    int n; cin >> n;
    VVI a(n,VI(5));
    REP(i,n)REP(j,5) cin >> a[i][j];
    VI b;
    REP(i,1<<5){
        vector<P> p(n);
        REP(j,n){
            ll sum=0;
            REP(k,5){
                if((i>>k)&1)
                    sum+=a[j][k];
                else
                    sum-=a[j][k];
            }
            p[j]={sum,j};
        }
        sort(ALL(p));
        b.push_back(p[n-1].second);
    }
    REP(i,n){
        ll ans=0;
        for(auto j:b){
            ll sum=0;
            REP(k,5){
                sum+=abs(a[i][k]-a[j][k]);
            }
            chmax(ans,sum);
        }
        cout << ans << endl;
    }
    return 0;
}
0