Language: C++


// Problem : E - Dist Max
// Contest : AtCoder - AtCoder Beginner Contest 178
// URL : https://atcoder.jp/contests/abc178/tasks/abc178_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
const long long int  modu=1e9+7;
#define endl '\n'
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define inp(x)  for(auto &t:x) cin>>t;
#define itr     vector<int>::iterator
#define debug(a) cout << #a << "=" << a << ' '<<endl;
#define out(x)  for(auto &t:x) cout<<t<<" "; cout<<endl;
#define ff first
#define ss second
#define pb push_back
#define initialize(a,v)  for(int i=0;i<a.size();++i) a[i]=v;
#define all(x) x.begin(),x.end()
#define mpt(mp) for(auto it=mp.begin();it!=mp.end();it++)
#define trav(x) for(int i=0;i<(int)x.size();++i)
#define mkp(a,b) make_pair(a,b)
#define sz(x)  (int)x.size()

int noofdig(int N)
{
	return floor(log10(N))+1;
}



ll f(ll a)
{

return 0;

}



void pre()
{

}

bool sortbysec(const pair<ll,ll> &a, 
              const pair<ll,ll> &b) 
{ 
    return (a.second < b.second); 
} 
  



void solve()
{
	int n;
	cin>>n;
	vector<pair<ll,>>a(n);
	
	for(int i=0;i<n;++i)
	{
		cin>>a[i].ff>>a[i].ss;
	}
	
	// sort by x 
	
	
    ll mx=-1;
    sort(all(a));
    
    int l=0;
    int r=n-1;
    
    while(l<=r)
    {
    	ll tmp=abs(a[l].ff-a[r].ff)+abs(a[l].ss-a[r].ss);
    	mx=max(mx,tmp);
    	++l;
    	--r;
    	
    }
    
    sort(all(a),sortbysec);
    
  
    
      int l1=0;
    int r1=n-1;
    
    while(1l<=r1)
    {
    	ll tmp=abs(a[l1].ff-a[r1].ff)+abs(a[l1].ss-a[r1].ss);
    	
    	mx=max(mx,tmp);
    	++l1;
    	--r1;
    	
    }
    
    
    cout<<mx<<endl;
    
    


}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:64:23: error: template argument 2 is invalid
   64 |         vector<pair<ll,>>a(n);
      |                       ^
a.cc:64:24: error: template argument 1 is invalid
   64 |         vector<pair<ll,>>a(n);
      |                        ^~
a.cc:64:24: error: template argument 2 is invalid
a.cc:68:23: error: invalid types 'int[int]' for array subscript
   68 |                 cin>>a[i].ff>>a[i].ss;
      |                       ^
a.cc:68:32: error: invalid types 'int[int]' for array subscript
   68 |                 cin>>a[i].ff>>a[i].ss;
      |                                ^
a.cc:24:18: error: request for member 'begin' in 'a', which is of non-class type 'int'
   24 | #define all(x) x.begin(),x.end()
      |                  ^~~~~
a.cc:75:10: note: in expansion of macro 'all'
   75 |     sort(all(a));
      |          ^~~
a.cc:24:28: error: request for member 'end' in 'a', which is of non-class type 'int'
   24 | #define all(x) x.begin(),x.end()
      |                            ^~~
a.cc:75:10: note: in expansion of macro 'all'
   75 |     sort(all(a));
      |          ^~~
a.cc:82:21: error: invalid types 'int[int]' for array subscript
   82 |         ll tmp=abs(a[l].ff-a[r].ff)+abs(a[l].ss-a[r].ss);
      |                     ^
a.cc:82:29: error: invalid types 'int[int]' for array subscript
   82 |         ll tmp=abs(a[l].ff-a[r].ff)+abs(a[l].ss-a[r].ss);
      |                             ^
a.cc:82:42: error: invalid types 'int[int]' for array subscript
   82 |         ll tmp=abs(a[l].ff-a[r].ff)+abs(a[l].ss-a[r].ss);
      |                                          ^
a.cc:82:50: error: invalid types 'int[int]' for array subscript
   82 |         ll tmp=abs(a[l].ff-a[r].ff)+abs(a[l].ss-a[r].ss);
      |                                                  ^
a.cc:24:18: error: request for member 'begin' in 'a', which is of non-class type 'int'
   24 | #define all(x) x.begin(),x.end()
      |                  ^~~~~
a.cc:89:10: note: in expansion of macro 'all'
   89 |     sort(all(a),sortbysec);
      |          ^~~
a.cc:24:28: error: request for member 'end' in 'a', which is of non-class type 'int'
   24 | #define all(x) x.begin(),x.end()
      |                            ^~~
a.cc:89:10: note: in expansion of macro 'all'
   89 |     sort(all(a),sortbysec);
      |          ^~~
a.cc:98:21: error: invalid types 'int[int]' for array subscript
   98 |         ll tmp=abs(a[l1].ff-a[r1].ff)+abs(a[l1].ss-a[r1].ss);
      |                     ^
a.cc:98:30: error: invalid types 'int[int]' for array subscript
   98 |         ll tmp=abs(a[l1].ff-a[r1].ff)+abs(a[l1].ss-a[r1].ss);
      |                              ^
a.cc:98:44: error: invalid types 'int[int]' for array subscript
   98 |         ll tmp=abs(a[l1].ff-a[r1].ff)+abs(a[l1].ss-a[r1].ss);
      |                                            ^
a.cc:98:53: error: invalid types 'int[int]' for array subscript
   98 |         ll tmp=abs(a[l1].ff-a[r1].ff)+abs(a[l1].ss-a[r1].ss);
      |                                                     ^