結果

問題 No.2261 Coffee
ユーザー simansiman
提出日時 2023-04-08 20:15:20
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 446 ms / 2,000 ms
コード長 936 bytes
コンパイル時間 1,051 ms
コンパイル使用メモリ 144,120 KB
実行使用メモリ 8,740 KB
最終ジャッジ日時 2024-04-14 16:45:53
合計ジャッジ時間 11,420 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 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,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 1 ms
6,944 KB
testcase_17 AC 13 ms
6,940 KB
testcase_18 AC 13 ms
6,940 KB
testcase_19 AC 11 ms
6,940 KB
testcase_20 AC 10 ms
6,944 KB
testcase_21 AC 13 ms
6,940 KB
testcase_22 AC 11 ms
6,940 KB
testcase_23 AC 14 ms
6,944 KB
testcase_24 AC 407 ms
8,292 KB
testcase_25 AC 348 ms
7,424 KB
testcase_26 AC 434 ms
8,504 KB
testcase_27 AC 399 ms
8,080 KB
testcase_28 AC 196 ms
7,680 KB
testcase_29 AC 189 ms
7,604 KB
testcase_30 AC 151 ms
6,944 KB
testcase_31 AC 252 ms
8,680 KB
testcase_32 AC 248 ms
8,576 KB
testcase_33 AC 247 ms
8,624 KB
testcase_34 AC 245 ms
8,584 KB
testcase_35 AC 249 ms
8,620 KB
testcase_36 AC 247 ms
8,664 KB
testcase_37 AC 245 ms
8,528 KB
testcase_38 AC 446 ms
8,624 KB
testcase_39 AC 441 ms
8,724 KB
testcase_40 AC 443 ms
8,504 KB
testcase_41 AC 442 ms
8,616 KB
testcase_42 AC 434 ms
8,600 KB
testcase_43 AC 441 ms
8,740 KB
testcase_44 AC 434 ms
8,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <climits>
#include <map>
#include <queue>
#include <set>
#include <cstring>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
  int N;
  cin >> N;

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

  vector<ll> ans(N, LLONG_MIN);

  for (int mask = 0; mask < (1 << 5); ++mask) {
    ll V[N];
    memset(V, 0, sizeof(V));
    ll min_v = LLONG_MAX;

    for (int i = 0; i < N; ++i) {
      for (int j = 0; j < 5; ++j) {
        if (mask >> j & 1) {
          V[i] += X[i][j];
        } else {
          V[i] -= X[i][j];
        }
      }

      min_v = min(min_v, V[i]);
    }

    for (int i = 0; i < N; ++i) {
      ans[i] = max(ans[i], V[i] - min_v);
    }
  }

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

  return 0;
}
0