結果

問題 No.3759 Watch Fireworks
コンテスト
ユーザー Rumain831
提出日時 2026-10-15 06:15:27
言語 C++23(gcc16)
(gcc 16.2.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 631 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,405 ms
コンパイル使用メモリ 183,284 KB
実行使用メモリ 11,956 KB
最終ジャッジ日時 2026-10-15 06:15:53
合計ジャッジ時間 7,925 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;

ll f(vector<ll>& x){
  int n=x.size();
  int mid2=n/2, mid1=mid2-1;
  if(n&1) return max(x[mid2]-x[0], x[n-1]-x[mid2]);
  else return max(x[mid1]-x[0], x[n-1]-x[mid2]);
}

int main(void){
  int n; cin >> n;
  vector<ll> x, y;
  for(int i=0; i<n; i++){
    ll a, b; cin >> a >> b;
    x.push_back(a+b);
    y.push_back(a-b);
  }
  // for(auto p:x) cout << p << ' '; cout << endl;
  // for(auto p:y) cout << p << ' '; cout << endl;
  sort(begin(x), end(x));
  sort(begin(y), end(y));
  cout << max(f(x), f(y)) << endl;
  return 0; 
}
0