結果

問題 No.1998 Manhattan Restaurant
ユーザー MasKoaTSMasKoaTS
提出日時 2022-03-23 18:49:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 896 bytes
コンパイル時間 758 ms
コンパイル使用メモリ 77,580 KB
実行使用メモリ 8,872 KB
最終ジャッジ日時 2023-10-21 01:14:43
合計ジャッジ時間 2,842 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 76 ms
8,872 KB
testcase_16 AC 36 ms
6,232 KB
testcase_17 AC 50 ms
7,552 KB
testcase_18 AC 40 ms
6,496 KB
testcase_19 AC 43 ms
6,760 KB
testcase_20 AC 75 ms
8,872 KB
testcase_21 AC 84 ms
8,872 KB
testcase_22 AC 83 ms
8,872 KB
testcase_23 AC 83 ms
8,872 KB
testcase_24 AC 85 ms
8,872 KB
testcase_25 AC 6 ms
4,348 KB
testcase_26 AC 39 ms
6,760 KB
testcase_27 AC 26 ms
5,704 KB
testcase_28 AC 40 ms
6,760 KB
testcase_29 AC 28 ms
5,704 KB
testcase_30 AC 56 ms
8,344 KB
testcase_31 AC 52 ms
7,816 KB
testcase_32 AC 8 ms
4,348 KB
testcase_33 AC 35 ms
6,232 KB
testcase_34 AC 43 ms
7,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#define rep(i, l, n) for (int i = (l); i < (n); i++)
#define chmin(x, y) if(x > (y)){ x = (y); }
#define chmax(x, y) if(x < (y)){ x = (y); }
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T> >;


int main(void) {
	int N;	 cin >> N;
	VV<ll> P(N, V<ll>(2));
	rep(i, 0, N) {
		ll x, y;	cin >> x >> y;
		P[i] = { x + y,x - y };
	}

	ll max_x = P[0][0], max_y = P[0][1], min_x = P[0][0], min_y = P[0][1];
	rep(i, 1, N) {
		chmax(max_x, P[i][0]);	chmax(max_y, P[i][1]);
		chmin(min_x, P[i][0]);	chmin(min_y, P[i][1]);
	}

	ll a = 0, b = 0;
	rep(i, 0, N) {
		ll x = P[i][0], y = P[i][1];
		chmax(a, min(max(max_x - x, max_y - y), max(x - min_x, y - min_y)));
		chmax(b, min(max(max_x - x, y - min_y), max(x - min_x, max_y - y)));
	}

	ll ans = min(a, b) / 2;
	cout << ans << endl;

	return 0;
}
0