結果
| 問題 |
No.1998 Manhattan Restaurant
|
| ユーザー |
MasKoaTS
|
| 提出日時 | 2022-03-23 18:49:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 94 ms / 2,000 ms |
| コード長 | 896 bytes |
| コンパイル時間 | 592 ms |
| コンパイル使用メモリ | 76,040 KB |
| 最終ジャッジ日時 | 2025-01-28 11:09:29 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
ソースコード
#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;
}
MasKoaTS