結果

問題 No.2261 Coffee
ユーザー kabipoyokabipoyo
提出日時 2023-04-07 23:45:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 470 ms / 2,000 ms
コード長 1,323 bytes
コンパイル時間 4,112 ms
コンパイル使用メモリ 257,860 KB
実行使用メモリ 12,108 KB
最終ジャッジ日時 2024-04-10 18:18:54
合計ジャッジ時間 14,478 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,812 KB
testcase_02 AC 1 ms
6,816 KB
testcase_03 AC 2 ms
6,816 KB
testcase_04 AC 2 ms
6,812 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,940 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,940 KB
testcase_17 AC 15 ms
6,944 KB
testcase_18 AC 13 ms
6,944 KB
testcase_19 AC 12 ms
6,940 KB
testcase_20 AC 10 ms
6,940 KB
testcase_21 AC 14 ms
6,940 KB
testcase_22 AC 11 ms
6,940 KB
testcase_23 AC 14 ms
6,944 KB
testcase_24 AC 431 ms
11,168 KB
testcase_25 AC 368 ms
10,240 KB
testcase_26 AC 469 ms
11,796 KB
testcase_27 AC 413 ms
11,264 KB
testcase_28 AC 210 ms
10,444 KB
testcase_29 AC 208 ms
10,240 KB
testcase_30 AC 162 ms
8,704 KB
testcase_31 AC 268 ms
11,984 KB
testcase_32 AC 267 ms
11,856 KB
testcase_33 AC 266 ms
11,984 KB
testcase_34 AC 270 ms
11,860 KB
testcase_35 AC 277 ms
11,984 KB
testcase_36 AC 264 ms
11,856 KB
testcase_37 AC 265 ms
11,984 KB
testcase_38 AC 455 ms
11,856 KB
testcase_39 AC 454 ms
11,860 KB
testcase_40 AC 458 ms
11,980 KB
testcase_41 AC 468 ms
11,984 KB
testcase_42 AC 448 ms
11,856 KB
testcase_43 AC 470 ms
11,984 KB
testcase_44 AC 450 ms
12,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef int64_t lint;
#define rep(i, n) for(int i=0; i<n; i++)
#define repx(i, l, n) for(int i=l; i<n; i++)
#define all(v) v.begin(), v.end()
#define show(x) cout << #x << ": " << x << endl;
#define list(x) cout << #x << ": " << x << "  ";
#define pb push_back
using vi = vector<lint>;
using vvi = vector<vector<lint>>;
template<class T> inline void vin(vector<T>& v) { rep(i, v.size()) cin >> v.at(i); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline void drop(T x) { cout << x << endl; exit(0); }
template<class T> void vout(vector<T> v) { rep(i, v.size()) { cout << v.at(i) << ' '; } cout << endl; }
constexpr lint LINF = LLONG_MAX/2;

int main() {
	lint N;
	cin >> N;
	vvi v(N, vi(5));
	rep(i, N) vin(v[i]);

	lint a=0, b=0, c=0, x, y, z;
	vi ans(N);
	rep(bits, 1<<5) {
		vi t(N);
		a = -LINF;
		b = LINF;
		rep(i, N) {
			rep(j, 5) {
				if ((bits & (1<<j)) != 0) {
					t[i] += v[i][j];
				} else {
					t[i] -= v[i][j];
				}
			}
			chmax(a, t[i]);
			chmin(b, t[i]);
		}
		rep(i, N) {
			chmax(ans[i], t[i]-b);
		}
	}
	rep(i, N) cout << ans[i] << endl;
}
0