Submission #16780034


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl '\n'
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repab(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define  printarr(v) for(auto x:v){cout<<x<<" "; }
#define debug1(a) cout<<#a<<" "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" "<<(a)<<" "<<#b<<" "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" "<<(a)<<" "<<#b<<" "<<(b)<<" "#c<<" "<<(c)<<endl;
typedef long double ld;
void solve()
{
	ll n;
	cin >> n;
	vector<vector<ll>> v(4, vector<ll>(n));
	rep(i, n)
	{
		ll x, y;
		cin >> x >> y;
		v[0][i] = (x - y);
		v[1][i] = (x + y);
		v[2][i] = (-x + y);
		v[3][i] = (-x - y);
	}
	for (int i = 0; i < 4; i++)
	{
		sort(v[i].begin(), v[i].end());
	}
	ll res = LLONG_MIN;
	for (int i = 0; i < 4; i++)
	{
		res = max(res, v[i][n - 1] - v[i][0]);
	}
	cout << res << endl;

}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	t = 1;
	while (t--)
	{
		solve();

	}
}

Submission Info

Submission Time
Task E - Dist Max
User EramallaAravind
Language C++ (GCC 9.2.1)
Score 500
Code Size 1106 Byte
Status AC
Exec Time 92 ms
Memory 11100 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 18
Set Name Test Cases
Sample sample00, sample01
All handmade02, handmade03, handmade04, handmade05, handmade06, handmade07, handmade08, handmade09, random07, random08, random09, random10, random11, random12, random13, random14, sample00, sample01
Case Name Status Exec Time Memory
handmade02 AC 10 ms 3488 KiB
handmade03 AC 2 ms 3524 KiB
handmade04 AC 2 ms 3468 KiB
handmade05 AC 64 ms 11064 KiB
handmade06 AC 51 ms 11012 KiB
handmade07 AC 76 ms 11028 KiB
handmade08 AC 71 ms 10924 KiB
handmade09 AC 78 ms 11100 KiB
random07 AC 89 ms 11004 KiB
random08 AC 91 ms 11096 KiB
random09 AC 92 ms 11080 KiB
random10 AC 89 ms 11060 KiB
random11 AC 92 ms 11072 KiB
random12 AC 92 ms 11016 KiB
random13 AC 88 ms 10684 KiB
random14 AC 63 ms 8112 KiB
sample00 AC 2 ms 3592 KiB
sample01 AC 2 ms 3544 KiB