結果

問題 No.2261 Coffee
ユーザー lddlinanlddlinan
提出日時 2023-04-07 22:23:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 261 ms / 2,000 ms
コード長 1,392 bytes
コンパイル時間 810 ms
コンパイル使用メモリ 87,348 KB
実行使用メモリ 10,060 KB
最終ジャッジ日時 2024-04-10 17:24:07
合計ジャッジ時間 7,905 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,880 KB
testcase_01 AC 2 ms
7,888 KB
testcase_02 AC 2 ms
8,008 KB
testcase_03 AC 3 ms
7,880 KB
testcase_04 AC 3 ms
7,880 KB
testcase_05 AC 2 ms
7,888 KB
testcase_06 AC 3 ms
7,888 KB
testcase_07 AC 2 ms
8,016 KB
testcase_08 AC 3 ms
7,892 KB
testcase_09 AC 3 ms
7,884 KB
testcase_10 AC 3 ms
8,008 KB
testcase_11 AC 2 ms
8,004 KB
testcase_12 AC 2 ms
7,884 KB
testcase_13 AC 3 ms
7,880 KB
testcase_14 AC 2 ms
7,888 KB
testcase_15 AC 2 ms
7,756 KB
testcase_16 AC 2 ms
7,892 KB
testcase_17 AC 8 ms
7,888 KB
testcase_18 AC 7 ms
8,064 KB
testcase_19 AC 7 ms
7,880 KB
testcase_20 AC 6 ms
7,892 KB
testcase_21 AC 7 ms
7,880 KB
testcase_22 AC 7 ms
7,884 KB
testcase_23 AC 8 ms
7,876 KB
testcase_24 AC 223 ms
9,808 KB
testcase_25 AC 188 ms
9,684 KB
testcase_26 AC 242 ms
10,056 KB
testcase_27 AC 221 ms
9,804 KB
testcase_28 AC 129 ms
9,676 KB
testcase_29 AC 134 ms
9,680 KB
testcase_30 AC 101 ms
9,160 KB
testcase_31 AC 170 ms
9,936 KB
testcase_32 AC 162 ms
9,940 KB
testcase_33 AC 161 ms
10,052 KB
testcase_34 AC 162 ms
9,928 KB
testcase_35 AC 170 ms
9,900 KB
testcase_36 AC 173 ms
9,940 KB
testcase_37 AC 172 ms
9,928 KB
testcase_38 AC 255 ms
9,940 KB
testcase_39 AC 245 ms
10,060 KB
testcase_40 AC 259 ms
10,060 KB
testcase_41 AC 261 ms
10,056 KB
testcase_42 AC 255 ms
9,928 KB
testcase_43 AC 248 ms
9,936 KB
testcase_44 AC 257 ms
10,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <map>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <algorithm>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <string>
using namespace std;

bool rcmp(int a, int b) { return a>b; }
typedef long long LL;
class mypcmp {
public:
    bool operator()(const int& a, const int& b) {
        return a<b;
    }
};



LL as[100004];
LL bs[100004];
LL cs[100004];
LL ds[100004];
LL es[100004];
LL rs[100004];
typedef struct { LL v; int i; } SNode;
SNode sg[100004];
bool mycmp(const SNode& a, const SNode& b) { return a.v<b.v; }
int main() {
    int n, i, k;
    LL v, d;
    scanf("%d", &n);
    for (i=0; i<n; i++) scanf("%lld %lld %lld %lld %lld", &as[i], &bs[i], &cs[i], &ds[i], &es[i]);
    for (i=0; i<n; i++) rs[i]=0;
    for (k=0; k<16; k++) {
        for (i=0; i<n; i++) {
            v=as[i]; if (k&1) v-=bs[i]; else v+=bs[i];
            if (k&2) v-=cs[i]; else v+=cs[i];
            if (k&4) v-=ds[i]; else v+=ds[i];
            if (k&8) v-=es[i]; else v+=es[i];
            sg[i].v=v; sg[i].i=i;
        }
        sort(sg, sg+n, mycmp);
        for (i=0; i<n; i++) {
            d=max(sg[i].v-sg[0].v, sg[n-1].v-sg[i].v);
            rs[sg[i].i]=max(d, rs[sg[i].i]);
        }
    }
    for (i=0; i<n; i++) printf("%lld\n", rs[i]);
    return 0;
}
0