結果
| 問題 | No.3759 Watch Fireworks |
| コンテスト | |
| ユーザー |
ei1333333
|
| 提出日時 | 2026-10-03 15:51:24 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 290 ms / 2,000 ms |
| + 230µs | |
| コード長 | 1,410 bytes |
| 記録 | |
| コンパイル時間 | 2,558 ms |
| コンパイル使用メモリ | 367,536 KB |
| 実行使用メモリ | 28,912 KB |
| 最終ジャッジ日時 | 2026-10-09 20:51:34 |
| 合計ジャッジ時間 | 7,147 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 47 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll inf = 1ll << 40;
int main() {
int N;
cin >> N;
vector< pair< ll, ll > > P(N);
ll x_min = inf, y_min = inf, x_max = -inf, y_max = -inf;
for (auto& [x, y] : P) {
int a, b;
cin >> a >> b;
x = a + b;
y = a - b;
x_min = min(x_min, x);
x_max = max(x_max, x);
y_min = min(y_min, y);
y_max = max(y_max, y);
}
ll ret = inf;
for (auto x : {x_min, x_max}) {
for (auto y : {y_min, y_max}) {
vector< tuple< ll, ll, ll > > vs;
for (auto& [a, b]: P) {
vs.emplace_back(max(abs(a - x), abs(b - y)), a, b);
}
ranges::sort(vs);
ll a_min = inf, a_max = -inf, b_min = inf, b_max = -inf;
vector score {0ll};
for (auto& [d, a, b]: vs) {
a_min = min(a_min, a);
a_max = max(a_max, a);
b_min = min(b_min, b);
b_max = max(b_max, b);
score.emplace_back(max(a_max - a_min, b_max - b_min));
}
a_min = inf, a_max = -inf, b_min = inf, b_max = -inf;
ret = min(ret, score.back());
for (auto& [d, a, b]: vs | views::reverse) {
a_min = min(a_min, a);
a_max = max(a_max, a);
b_min = min(b_min, b);
b_max = max(b_max, b);
score.pop_back();
ret = min(ret, max({a_max - a_min, b_max - b_min, score.back()}));
}
}
}
cout << ret << endl;
}
ei1333333