結果

問題 No.1998 Manhattan Restaurant
コンテスト
ユーザー 👑 cologne
提出日時 2022-03-21 16:29:40
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 16 ms / 2,000 ms
+ 210µs
コード長 684 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 928 ms
コンパイル使用メモリ 169,016 KB
実行使用メモリ 9,808 KB
最終ジャッジ日時 2026-09-01 08:57:04
合計ジャッジ時間 4,136 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <algorithm>
#include <climits>
#include <iostream>
#include <vector>

using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<pair<int, int>> V(N);

	int mina = INT_MAX, maxa = INT_MIN, minb = INT_MAX, maxb = INT_MIN;
	for (auto &[a, b] : V)
	{
		int x, y;
		cin >> x >> y;
		a = (x + y) / 2, b = (x - y) / 2;
		mina = min(mina, a), maxa = max(maxa, a);
		minb = min(minb, b), maxb = max(maxb, b);
	}
	int ans1 = 0, ans2 = 0;
	for (auto [a, b] : V)
	{
		ans1 = max(ans1, min(max(a - mina, b - minb), max(maxa - a, maxb - b)));
		ans2 = max(ans2, min(max(a - mina, maxb - b), max(maxa - a, b - minb)));
	}
	cout << min(ans1, ans2) << endl;
}
0