結果
| 問題 | No.3759 Watch Fireworks |
| コンテスト | |
| ユーザー |
ei1333333
|
| 提出日時 | 2026-09-26 20:31:45 |
| 言語 | C++23(gcc16) (gcc 16.2.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 318 ms / 2,000 ms |
| + 997µs | |
| コード長 | 1,055 bytes |
| 記録 | |
| コンパイル時間 | 2,283 ms |
| コンパイル使用メモリ | 365,048 KB |
| 実行使用メモリ | 12,800 KB |
| 最終ジャッジ日時 | 2026-10-09 20:51:13 |
| 合計ジャッジ時間 | 6,605 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 47 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll inf = 1e10;
int main() {
int N;
cin >> N;
vector< ll > A(N), B(N);
for (int i = 0; i < N; i++) {
int x, y;
cin >> x >> y;
A[i] = x - y;
B[i] = x + y;
}
auto as = A;
auto bs = B;
ranges::sort(as);
ranges::sort(bs);
ll ok = inf, ng = -1;
auto check = [&](ll d) -> bool {
for (auto x : {as[0], as[N - 1] - d}) {
for (auto y : {bs[0], bs[N - 1] - d}) {
auto lx = inf, ly = inf, rx = -inf, ry = -inf;
for (int i = 0; i < N; i++) {
if (x <= A[i] && A[i] <= x + d && y <= B[i] && B[i] <= y + d) {
continue;
}
lx = min(lx, A[i]);
rx = max(rx, A[i]);
ly = min(ly, B[i]);
ry = max(ry, B[i]);
}
if (rx - lx <= d && ry - ly <= d) {
return true;
}
}
}
return false;
};
while (ok - ng > 1) {
auto mid = (ok + ng) / 2;
if (check(mid)) ok = mid;
else ng = mid;
}
cout << ok << endl;
}
ei1333333