結果
| 問題 | No.3759 Watch Fireworks |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-10 00:19:27 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 114 ms / 2,000 ms |
| + 929µs | |
| コード長 | 1,820 bytes |
| 記録 | |
| コンパイル時間 | 1,066 ms |
| コンパイル使用メモリ | 217,864 KB |
| 実行使用メモリ | 9,868 KB |
| 最終ジャッジ日時 | 2026-10-10 00:19:33 |
| 合計ジャッジ時間 | 4,692 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 47 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N; cin >> N;
vector<pair<long long,long long>> XY(N);
long long maxX = -1e18,minX = 1e18,minY = 1e18,maxY = -1e18;
for(auto &[x,y] : XY){
cin >> x >> y;
x += y,y = x-y*2;
maxX = max(maxX,x),minX = min(minX,x);
maxY = max(maxY,y),minY = min(minY,y);
}
const long long inf = 1e18;
long long low = -1,high = 1e10;
while(high-low > 1){
long long mid = (high+low)/2;
bool ok = true;
if(maxX-minX <= mid){
for(auto [x,y] : XY){
if(minY+mid >= y || maxY-mid <= y) continue;
ok = false; break;
}
}
else if(maxY-minY <= mid){
for(auto [x,y] : XY){
if(minX+mid >= x || maxX-mid <= x) continue;
ok = false; break;
}
}
else{
ok = false;
{
long long xl = inf,xr = -inf,yl = inf,yr = -inf;
for(auto [x,y] : XY){
if(maxX-mid <= x && maxY-mid <= y) continue;
xl = min(xl,x),xr = max(xr,x),yl = min(yl,y),yr = max(yr,y);
}
if(xl == -inf || max(xr-xl,yr-yl) <= mid) ok = true;
}
{
long long xl = inf,xr = -inf,yl = inf,yr = -inf;
for(auto [x,y] : XY){
if(maxX-mid <= x && minY+mid >= y) continue;
xl = min(xl,x),xr = max(xr,x),yl = min(yl,y),yr = max(yr,y);
}
if(xl == -inf || max(xr-xl,yr-yl) <= mid) ok = true;
}
}
if(ok) high = mid;
else low = mid;
}
cout << high << endl;
}