結果

問題 No.2261 Coffee
ユーザー nagisa5101nagisa5101
提出日時 2023-04-07 21:51:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,733 bytes
コンパイル時間 4,833 ms
コンパイル使用メモリ 262,036 KB
実行使用メモリ 146,048 KB
最終ジャッジ日時 2024-04-10 16:57:57
合計ジャッジ時間 10,312 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,752 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 4 ms
5,376 KB
testcase_11 AC 4 ms
5,376 KB
testcase_12 AC 3 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 4 ms
5,376 KB
testcase_15 AC 3 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 76 ms
8,448 KB
testcase_18 AC 71 ms
8,064 KB
testcase_19 AC 59 ms
7,808 KB
testcase_20 AC 48 ms
7,296 KB
testcase_21 AC 78 ms
8,704 KB
testcase_22 AC 51 ms
7,424 KB
testcase_23 AC 79 ms
9,088 KB
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace atcoder;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repll(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep2(i, n, m) for (int i = n; i < (int)(m); i++)
#define repll2(i, n, m) for (long long i = n; i < (long long)(m); i++)
#define all(v) v.begin(),v.end()
using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vvvl=vector<vvl>;
using vld=vector<ld>;
using vvld=vector<vld>;

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,1,-1};

const double PI = acos(-1);
//const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=(1LL<<60);
const int INF2=(1<<30);
//using mint=modint1000000007;
//using mint=modint998244353;

int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll n;cin>>n;
    vvl arr(n);
    vector<multiset<ll>> vmst(32);
    rep(i,n){
        ll a[5];
        rep(j,5)cin>>a[j];
        rep(j,1<<5){
            ll s=0;
            rep(k,5){
                if(j&(1<<k))s+=a[k];
                else s-=a[k];
            }
            vmst[j].insert(s);
            arr[i].push_back(s);
        }
    }
    rep(i,n){
        rep(j,1<<5){
            vmst[j].erase(vmst[j].lower_bound(arr[i][j]));
        }
        ll ans=0;
        rep(j,1<<5){
            ll v=arr[i][j];
            ll u=*vmst[31-j].rbegin();
            ans=max(ans,v+u);
        }
        cout<<ans<<endl;
        rep(j,1<<5){
            vmst[j].insert(arr[i][j]);
        }
    }
    return 0;
}
0