結果

問題 No.2436 Min Diff Distance
ユーザー cho435cho435
提出日時 2023-08-11 18:37:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 624 bytes
コンパイル時間 6,035 ms
コンパイル使用メモリ 300,328 KB
実行使用メモリ 14,016 KB
最終ジャッジ日時 2024-04-29 10:03:38
合計ジャッジ時間 10,720 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin>>n;
	vector<int> x(n),y(n);
	rep(i,n) cin>>x.at(i)>>y.at(i);
	auto d=[&](int i,int j){
		return abs(x.at(i)-x.at(j))+abs(y.at(i)-y.at(j));
	};
	int ans=1e9;
	rep(i,n){
		int mx=0;
		int mn=1e9;
		rep(j,n){
			if(i==j) continue;
			mx=max(mx,d(i,j));
			mn=min(mn,d(i,j));
		}
		ans=min(ans,mx-mn);
	}
	cout<<ans<<endl;
}
0