結果

問題 No.3759 Watch Fireworks
コンテスト
ユーザー 蜜蜂
提出日時 2026-10-09 21:30:42
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,938 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,742 ms
コンパイル使用メモリ 380,876 KB
実行使用メモリ 9,912 KB
最終ジャッジ日時 2026-10-09 21:30:53
合計ジャッジ時間 7,502 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// https://atcoder.jp/contests/joi2010ho/tasks/joi2010ho_d

//g++ 1.cpp -std=c++14 -O2 -I .
#include <bits/stdc++.h>
using namespace std;

#include <atcoder/all>
using namespace atcoder;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vst = vector<string>;
using vvst = vector<vst>;

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define pq_big(T) priority_queue<T,vector<T>,less<T>>
#define pq_small(T) priority_queue<T,vector<T>,greater<T>>
#define all(a) a.begin(),a.end()
#define rep(i,start,end) for(ll i=start;i<(ll)(end);i++)
#define per(i,start,end) for(ll i=start;i>=(ll)(end);i--)
#define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end())

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin>>n;

  int min_w=1e9,max_w=-1e9;
  int min_v=1e9,max_v=-1e9;

  vector<pair<int,int>> p(n);
  rep(i,0,n){
    int x,y;
    cin>>x>>y;
    int w=x+y,v=x-y;
    p[i]={w,v};
    min_w=min(min_w,w);
    max_w=max(max_w,w);
    min_v=min(min_v,v);
    max_v=max(max_v,v);
  }

  int ng=-1,ok=2e9;
  while(ok-ng>1){
    int check=(ok+ng)/2;

    int flg=0;
    int flg2;

    flg2=1;
    rep(i,0,n){
      auto [w,v]=p[i];
      int flg3=0;
      if(abs(min_w-w)<=check&&abs(min_v-v)<=check){
        flg3=1;
      }
      if(abs(max_w-w)<=check&&abs(max_v-v)<=check){
        flg3=1;
      }
      flg2=min(flg2,flg3);
    }

    flg=max(flg,flg2);

    flg2=1;
    rep(i,0,n){
      auto [w,v]=p[i];
      int flg3=0;
      if(abs(min_w-w)<=check&&abs(max_v-v)<=check){
        flg3=1;
      }
      if(abs(max_w-w)<=check&&abs(min_v-v)<=check){
        flg3=1;
      }
      flg2=min(flg2,flg3);
    }

    flg=max(flg,flg2);

    if(flg==1){
      ok=check;
    }
    else{
      ng=check;
    }
  }

  cout<<ok<<endl;
}
0