#include #include #include #include using namespace std; typedef long long ll; ll INF = 1000000000000000; ll mod = 998244353; struct segment_tree{ int n; vector seg; segment_tree(){} segment_tree(int sz){n = sz; seg.resize(2*n);} segment_tree(vector v){ n = v.size(); seg.resize(2*n); for(int i=0;i0;i--) seg[i] = (seg[i<<1] + seg[i<<1|1])%mod; } void init(int sz){n = sz; seg.resize(2*n);} void update(int p,ll val){ for((seg[p += n] += val) %= mod;p>1;p>>=1) seg[p>>1] = (seg[p] + seg[p^1])%mod; } ll query(int l,int r){ ll res = 0; for(l += n,r += n; l>=1,r>>=1){ if(l&1) res = (res + seg[l++])%mod; if(r&1) res = (res + seg[--r])%mod; } return res; } void clear(){for(int i=0;i<2*n;i++) seg[i] = 0;} }; ll x[200010],y[200010]; int main(){ int i,n; cin >> n; vector> v; for(i=0;i> x[i] >> y[i]; v.push_back({x[i] + y[i],x[i] - y[i]}); } ll sx = x[0] + y[0],sy = x[0] - y[0]; ll gx = x[n - 1] + y[n - 1],gy = x[n - 1] - y[n - 1]; for(i=0;igx) v[i].first *= -1; if(sy>gy) v[i].second *= -1; } if(sx>gx) sx *= -1, gx *= -1; if(sy>gy) sy *= -1, gy *= -1; sort(v.begin(),v.end()); /*for(auto p:v){ cout << p.first << " " << p.second << endl; }*/ //cout << sx << " " << sy << " " << gx << " " << gy << endl; vector z(n); for(i=0;i