結果
| 問題 | No.3759 Watch Fireworks |
| コンテスト | |
| ユーザー |
👑 kmjp
|
| 提出日時 | 2026-10-09 22:50:49 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 1,502 bytes |
| 記録 | |
| コンパイル時間 | 1,184 ms |
| コンパイル使用メモリ | 220,804 KB |
| 実行使用メモリ | 16,924 KB |
| 最終ジャッジ日時 | 2026-10-09 22:50:54 |
| 合計ジャッジ時間 | 5,281 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge4_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 WA * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------
int N;
ll X[303030],Y[303030];
vector<ll> Xs,Ys;
int hoge(ll v) {
vector<ll> XC={Xs[0],Xs.back()-v};
vector<ll> YC={Ys[0],Ys.back()-v};
int i;
FORR(sx,XC) FORR(sy,YC) {
ll L=1LL<<60,R=-1LL<<60,U=-1LL<<60,D=1LL<<60;
FOR(i,N) {
if(X[i]<sx||X[i]>sx+v||Y[i]<sy||Y[i]>sy+v) {
L=min(L,X[i]);
R=max(R,X[i]);
D=min(D,X[i]);
U=max(U,X[i]);
}
}
if(R-L<=v&&U-D<=v) return 1;
}
return 0;
}
void solve() {
int i,j,k,l,r,x,y; string s;
cin>>N;
FOR(i,N) {
cin>>x>>y;
X[i]=x+y;
Y[i]=x-y;
Xs.push_back(X[i]);
Ys.push_back(Y[i]);
}
sort(ALL(Xs));
sort(ALL(Ys));
ll ret=(1LL<<40)-1;
for(i=39;i>=0;i--) if(hoge(ret-(1LL<<i))) ret-=1LL<<i;
cout<<ret<<endl;
}
int main(int argc,char** argv){
string s;int i;
if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
cout.tie(0); solve(); return 0;
}
kmjp