結果

問題 No.2261 Coffee
ユーザー HIcoderHIcoder
提出日時 2023-07-06 22:08:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 440 ms / 2,000 ms
コード長 1,164 bytes
コンパイル時間 2,384 ms
コンパイル使用メモリ 103,196 KB
実行使用メモリ 11,872 KB
最終ジャッジ日時 2023-09-27 23:08:31
合計ジャッジ時間 16,385 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 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 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 14 ms
4,380 KB
testcase_18 AC 12 ms
4,376 KB
testcase_19 AC 12 ms
4,380 KB
testcase_20 AC 10 ms
4,376 KB
testcase_21 AC 13 ms
4,376 KB
testcase_22 AC 10 ms
4,376 KB
testcase_23 AC 14 ms
4,376 KB
testcase_24 AC 403 ms
11,080 KB
testcase_25 AC 345 ms
9,968 KB
testcase_26 AC 432 ms
11,352 KB
testcase_27 AC 396 ms
11,016 KB
testcase_28 AC 204 ms
10,196 KB
testcase_29 AC 202 ms
10,280 KB
testcase_30 AC 158 ms
8,508 KB
testcase_31 AC 259 ms
11,420 KB
testcase_32 AC 262 ms
11,468 KB
testcase_33 AC 261 ms
11,424 KB
testcase_34 AC 260 ms
11,424 KB
testcase_35 AC 260 ms
11,456 KB
testcase_36 AC 262 ms
11,808 KB
testcase_37 AC 266 ms
11,608 KB
testcase_38 AC 438 ms
11,428 KB
testcase_39 AC 440 ms
11,872 KB
testcase_40 AC 437 ms
11,424 KB
testcase_41 AC 439 ms
11,804 KB
testcase_42 AC 440 ms
11,468 KB
testcase_43 AC 437 ms
11,412 KB
testcase_44 AC 438 ms
11,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
方針を聞いてAC
*/
#include<iostream>
#include<set>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<numeric>
#include<queue>
#include<cmath>
using namespace std;
typedef long long ll;
const ll INF=1LL<<60;
typedef pair<int,int> P;
typedef pair<int,P> PP;
const ll MOD=998244353;
const double PI=acos(-1);

int main(){
    int N;
    cin>>N;
    vector<vector<ll>> A(N,vector<ll>(5));
    for(int i=0;i<N;i++){
        for(int j=0;j<5;j++){
            cin>>A[i][j];
        }
    }

    vector<ll> ans(N);
    const int r=5;

    for(int S=0;S<(1<<r);S++){
        
        ll candmax=-INF,candmin=INF;
        vector<ll> F(N,0);
        for(int i=0;i<N;i++){
            for(int t=0;t<r;t++){
                if((S>>t)&1){
                    F[i]-=A[i][t];
                }else{
                    F[i]+=A[i][t];
                }
            }
            candmax=max(candmax,F[i]);
            candmin=max(candmin,F[i]);
        }

        for(int i=0;i<N;i++){
            ans[i]=max({ans[i],candmax-F[i],F[i]-candmin});
        }

    }

    for(int i=0;i<N;i++){
        cout<<ans[i]<<endl;
    }


  

}
0