problem_id
stringclasses
100 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
6
806
p02556
s489387701
Accepted
n = int(input()) plus_max = 10**20 * -1 plus_min = 10**20 minus_max = 10**20 * -1 minus_min = 10**20 for _ in range(n): x, y = map(int, input().split()) plus_max = max(plus_max, x + y) plus_min = min(plus_min, x + y) minus_max = max(minus_max, x - y) minus_min = min(minus_min, x - y) print(max(plus_max - plus_min, minus_max - minus_min))
p02556
s030866551
Accepted
N = int(input()) x = [0] * N y = [0] * N for i in range(N): x[i], y[i] = map(int, input().split()) d = [0] * N s = [0] * N for i in range(N): d[i] = x[i] - y[i] s[i] = x[i] + y[i] print(max(max(s)-min(s), max(d)-min(d)))
p02556
s296144198
Accepted
n = int(input()) X = [0] * n Y = [0] * n cx = [] cy = [] for i in range(n): X[i], Y[i] = map(int, input().split()) cx.append(X[i] - Y[i]) cy.append(X[i] + Y[i]) #print(X, Y) #print(cx, cy) ans = max(max(cx) - min(cx), max(cy) - min(cy)) print(ans)
p02556
s667125974
Accepted
import sys def input(): return sys.stdin.readline()[:-1] N=int(input()) pa,ma=-10**10,-10**10 pi,mi=10**10,10**10 for i in range(N): x,y=map(int,input().split()) s=x+y if s>pa: pa=s if s<pi: pi=s s=x-y if s>ma: ma=s if s<mi: mi=s print(max(pa-pi,ma-mi))
p02556
s918406301
Accepted
n=int(input()) p=[] for i in range(n): p.append(list(map(int,input().split()))) a=[] b=[] for i in range(n): a.append(p[i][0]+p[i][1]) b.append(p[i][0]-p[i][1]) a.sort() b.sort() print(max(a[n-1]-a[0],b[n-1]-b[0]))
p02556
s983699031
Accepted
N = int(input()) lst = [[0, 0, 0, 0] for _ in range(N)] p = [0] * N m = [0] * N for i in range(N): x, y = map(int, input().split()) lst[i][0] = x lst[i][1] = y p[i] = x+y m[i] = x-y d = max( max(p) - min(p), max(m) - min(m) ) print(d)
p02556
s832549841
Accepted
#!/usr/bin python3 # -*- coding: utf-8 -*- n = int(input()) u = [0]*n v = [0]*n for i in range(n): x, y = map(int, input().split()) u[i] = x+y v[i] = x-y ret = 0 ret = max(ret, max(u)-min(u)) ret = max(ret, max(v)-min(v)) print(ret)
p02556
s980327776
Accepted
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) inf = 10**18 N = int(input()) xmax = -inf xmin = inf ymax = -inf ymin = inf for _ in range(N): a, b = map(int, input().split()) x = a + b y = a - b xmax = max(xmax, x) xmin = min(xmin, x) ymax = max(ymax, y) ymin = min(ymin, y) print(max(xmax-xmin, ymax-ymin))
p02556
s422393822
Accepted
def main(): import sys def input(): return sys.stdin.readline()[:-1] N=int(input()) A=[list(map(int,input().split())) for _ in range(N)] B=[] C=[] for x in A: B.append(x[0]+x[1]) C.append(x[0]-x[1]) b=max(B)-min(B) c=max(C)-min(C) d=[b,c] print(max(d)) if __name__ == '__main__': main()
p02556
s341689572
Accepted
N = int(input()) xyp = [] xym = [] for _ in range(N): x, y = map(int, input().split()) xyp.append(x+y) xym.append(x-y) xyp.sort() xym.sort() print(max(xyp[-1] - xyp[0], xym[-1] - xym[0]))
p02556
s494810282
Accepted
def max_min(val,pos): if val<abs_max[pos][0]: abs_max[pos][0]=val elif val>abs_max[pos][1]: abs_max[pos][1]=val n=int(input()) abs_max=[[float('inf'),float('-inf')] for __ in range(4)] for _ in range(n): x,y=map(int,input().split()) max_min(x+y,0) max_min(x-y,1) max_min(-x+y,2) max_min(-x-y,3) ans=0 for Min,Max in abs_max: ans=max(ans,Max-Min) print(ans)
p02556
s141518167
Accepted
n = int(input()) max_diff = -float('inf') min_diff = float('inf') max_sum = -float('inf') min_sum = float('inf') for _ in range(n): x, y =map(int, input().split()) max_diff = max(max_diff, x-y) min_diff = min(min_diff, x-y) max_sum = max(max_sum, x+y) min_sum = min(min_sum, x+y) print(max(max_diff - min_diff, max_sum - min_sum))
p02556
s895240472
Accepted
import sys input=sys.stdin.readline n=int(input()) a,b,c,d=-10**9,10**9,-10**9,10**9 for _ in range(n): x,y=map(int,input().split()) a=max(a,x+y) b=min(b,x+y) c=max(c,x-y) d=min(d,x-y) print(max(a-b,c-d))
p02556
s906023781
Accepted
N = int(input()) xy = [tuple(map(int, input().split())) for _ in range(N)] xy.sort(reverse=True) ans = 0 M = xy[0][0] + xy[0][1] m = xy[0][0] - xy[0][1] for x, y in xy[1:]: ans = max(ans, M-x-y, m-x+y) M = max(M, x+y) m = max(m, x-y) print(ans)
p02556
s728744091
Accepted
import sys input=sys.stdin.readline def main(): n=int(input()) XY=[tuple(map(int,input().split())) for _ in range(n)] U,V=[],[] for x,y in XY: U.append(x+y) V.append(x-y) print(max(max(U)-min(U),max(V)-min(V))) if __name__=='__main__': main()
p02556
s652874794
Accepted
import sys sys.setrecursionlimit(10000000) input = sys.stdin.readline n = int(input()) INF = 1 << 35 M = -INF m = INF d0 = [] d1 = [] for i in range(n): x, y = map(int, input().split()) a = x - y b = x + y d0.append(a) d1.append(b) print(max(max(d0) - min(d0), max(d1) - min(d1)))
p02556
s589977744
Accepted
n = int(input()) xy = [list(map(int,input().split())) for _ in range(n)] a = [] b = [] for i in range(n): a.append(xy[i][0]+xy[i][1]) b.append(xy[i][0]-xy[i][1]) a_sort = sorted(a) b_sort = sorted(b) print(max(a_sort[-1]-a_sort[0],b_sort[-1]-b_sort[0]))
p02556
s331712154
Accepted
N = int(input()) a14=set([]) a23=set([]) for _ in range(N): x,y=map(int, input().split()) a14.add(x+y) a23.add(x-y) b14=max(a14)-min(a14) b23=max(a23)-min(a23) print(max(b14,b23)) # 2darray [[0] * 4 for i in range(3)] # import itertools
p02556
s031003258
Accepted
n = int(input()) mi0,ma0 = 10**9,-(10**9) mi1,ma1 = 10**9,-(10**9) for i in range(n): a,b = map(int, input().split()) c,d = a-b,a+b if c < mi0: mi0 = c if c > ma0: ma0 = c if d < mi1: mi1 = d if d > ma1: ma1 = d print(max(ma0-mi0,ma1-mi1))
p02556
s949928848
Accepted
N = int(input()) XY = [list(map(int,input().split())) for _ in range(N)] ans = 0 def measure(originX,originY): dist = [] for X,Y in XY: dist.append(abs(X-originX)+abs(Y-originY)) return max(dist)-min(dist) originX = 0 originY = 0 ans = max(ans,measure(originX,originY)) originX = 10**9 originY = 0 ans = max(ans,measure(originX,originY)) originX = 0 originY = 10**9 ans = max(ans,measure(originX,originY)) originX = 10**9 originY = 10**9 ans = max(ans,measure(originX,originY)) print(ans)
p02556
s323960309
Accepted
N = int(input()) X = [[] for _ in range(N)] z = [0 for _ in range(N)] w = [0 for _ in range(N)] for i in range(N): X[i] = list(map(int, input().split())) z[i] = X[i][0] +X[i][1] w[i] = X[i][0] -X[i][1] ans = max(max(z)-min(z), max(w)-min(w)) print(ans)
p02556
s816955433
Accepted
n=int(input()) ma=2 mi=10**9+7 mu=2 me=10**10 for i in range(n): x,y=map(int,input().split()) l=x+y s=-x+10**9+1+y ma=max(ma,l) mi=min(mi,l) mu=max(mu,s) me=min(me,s) print(max(ma-mi,mu-me))
p02556
s084305398
Accepted
l=[list(map(int,input().split())) for _ in range(int(input()))] f=sorted([x+y for x,y in l]) g=sorted([x-y for x,y in l]) print(max(f[-1]-f[0],g[-1]-g[0]))
p02556
s008307052
Accepted
n=int(input()) x=[0]*n y=[0]*n z=[] w=[] for i in range(n): x[i],y[i]= list(map(int, input().strip().split())) z.append(x[i]+y[i]) w.append(x[i]-y[i]) a=max(z)-min(z) b=max(w)-min(w) print(max(a,b))
p02556
s761012271
Accepted
n = int(input()) p_mn = m_mn= 10**9 * 2 p_mx = m_mx = -p_mn for i in range(n): x, y = map(int, input().split()) p = x + y m = x - y p_mx = max(p_mx, p) p_mn = min(p_mn, p) m_mx = max(m_mx, m) m_mn = min(m_mn, m) print(max(p_mx-p_mn, m_mx-m_mn))
p02556
s906332048
Accepted
N = int(input()) x = [0] * N y = [0] * N for i in range(N): x[i], y[i] = map(int, input().split()) d = [0] * N s = [0] * N for i in range(N): d[i] = x[i] - y[i] s[i] = x[i] + y[i] print(max(max(s)-min(s), max(d)-min(d)))
p02556
s369684697
Accepted
n = int(input()) c = [[int(i) for i in input().split()] for i in range(n)] z = [] w = [] for i in range(n): z.append(c[i][0] + c[i][1]) w.append(c[i][1] - c[i][0]) ans = max(max(z)-min(z), max(w)-min(w)) print(ans)
p02556
s435615687
Accepted
n=int(input()) rmax=-10**10 rmin=10**10 lmax=-10**10 lmin=10**10 for i in range(n): xi,yi=map(int,input().split()) rmax=max(rmax,xi+yi) rmin=min(rmin,xi+yi) lmax=max(lmax,xi-yi) lmin=min(lmin,xi-yi) print(max(rmax-rmin,lmax-lmin))
p02556
s556176670
Accepted
n=int(input()) p=[] m=[] bb=0 tt=False for i in range(n): x,y=list(map(int,input().split())) p.append(x+y) m.append(x-y) bb+=1 minp=min(p) maxp=max(p) minm=min(m) maxm=max(m) ans=[maxp-minp,maxm-minm,minm,maxm,minp-maxp] print(max(ans))
p02556
s416265713
Accepted
N=int(input()) xy = [tuple(map(int,input().split())) for _ in range(N)] ans = 0 def dist(tpl1, tpl2): return abs(tpl1[0] - tpl2[0]) + abs(tpl1[1] - tpl2[1]) f0 = [] f1 = [] for i in range(N): x, y = xy[i] f0.append(x-y) f1.append(x+y) ans = max(ans, max(f0) - min(f0), max(f1) - min(f1)) print(ans)
p02556
s788270992
Accepted
def main(): n = int(input()) s = [0] * n d = [0] * n for i in range(n): x, y = map(int, input().split()) s[i] = x + y d[i] = x - y print(max(max(s) - min(s), max(d) - min(d))) if __name__ == '__main__': main()
p02556
s637731714
Accepted
def solve(n, x, y): z = [u + v for u, v in zip(x, y)] w = [u - v for u, v in zip(x, y)] return max([max(z) - min(z), max(w) - min(w)]) n = int(input()) x, y = zip(*[map(int, input().split()) for i in range(n)]) print(solve(n, x, y))
p02556
s366355919
Accepted
N = int(input()) xpy = [0]*N xmy = [0]*N for i in range(N): x,y = map(int, input().split()) xpy[i] = x+y xmy[i] = x-y xpy.sort() xmy.sort() print(max(xpy[-1]-xpy[0],xmy[-1]-xmy[0]))
p02556
s807965507
Accepted
n = int(input()) plus = [] minus = [] for i in range(n): x, y = map(int, input().split()) plus.append(x + y) minus.append(x - y) result = max(max(plus) - min(plus), max(minus) - min(minus)) print(result)
p02556
s819622927
Accepted
n = int(input().strip()) l = [] for i in range(n): x, y = map(int, input().split()) a = y + x b = y - x l.append([x, y, a, b]) la = sorted(l, key=lambda z: z[2]) lb = sorted(l, key=lambda z: z[3]) print(max(abs(la[0][0] - la[-1][0]) + abs(la[0][1]-la[-1][1]), abs(lb[0][0] - lb[-1][0]) + abs(lb[0][1]-lb[-1][1]) ) )
p02556
s619058546
Accepted
n = int(input()) p = [] m = [] for i in range(n): x,y = map(int,input().split()) p.append(x+y) m.append(x-y) p.sort() m.sort() print(max(p[-1]-p[0],m[-1]-m[0]))
p02556
s737747475
Accepted
N = int(input()) X = [0] * N Y = [0] * N for i in range(N): X[i], Y[i] = map(int,input().split()) MAX = float('-inf') MIN = float('inf') for i in range(N): MAX = max(MAX, X[i] - Y[i]) MIN = min(MIN, X[i] - Y[i]) ans = MAX - MIN MAX = float('-inf') MIN = float('inf') for i in range(N): MAX = max(MAX, X[i] + Y[i]) MIN = min(MIN, X[i] + Y[i]) ans = max(ans, MAX - MIN) print(ans)
p02556
s808646974
Accepted
n = int(input()) s = [] m = [] for i in range(n): a, b = map(int, input().split()) s.append(a+b) m.append(a-b) print(max(max(s)-min(s), max(m)-min(m)))
p02556
s780622781
Accepted
N = int(input()) z = [0] * N w = [0] * N for i in range(N): x, y = map(int, input().split()) z[i] = x + y w[i] = x - y z = sorted(z) w = sorted(w) #print(z) #print(w) ans = max(abs(z[-1] - z[0]), abs(w[-1] - w[0])) print(ans)
p02556
s190715090
Accepted
N = int(input()) xs = [] ys = [] for _ in range(N): x,y = map(int,input().split()) xs.append(x) ys.append(y) fxys = [[], []] for i in range(N): x = xs[i] y = ys[i] fxys[0].append(x-y) fxys[1].append(x+y) ls = [] for d in [0, 1]: mx = max(fxys[d]) mi = min(fxys[d]) ls.append(mx-mi) print(max(ls))
p02556
s275514072
Accepted
import sys input = sys.stdin.readline N = int(input()) SUM,DIF = [],[] for _ in range(N): x,y = map(int, input().split()) SUM.append(x+y) DIF.append(x-y) SUM.sort() DIF.sort() print(max(abs(SUM[0] - SUM[-1]), abs(DIF[0] - DIF[-1])))
p02556
s871569031
Accepted
import sys input = sys.stdin.readline def main(): n = int(input()) plus = [] minus = [] for _ in range(n): x, y = map(int, input().split()) plus.append(x + y) minus.append(x - y) plus.sort() minus.sort() ans = max(plus[-1] - plus[0], minus[-1] - minus[0]) print(ans) main()
p02556
s794182622
Accepted
n=int(input()) arr1=[0]*n arr2=[0]*n for i in range(n): x,y=map(int, input().split()) arr1[i]=x+y arr2[i]=x-y arr1=sorted(arr1) p=arr1[-1]-arr1[0] arr2=sorted(arr2) q=arr2[-1]-arr2[0] print(max(p,q))
p02556
s677376098
Accepted
n,*z=map(int,open(0).read().split()) a,b=[],[] for x,y in zip(*[iter(z)]*2): a+=x+y, b+=x-y, print(max(abs(max(a)-min(a)),abs(max(b)-min(b))))
p02556
s213065890
Accepted
N = int(input()) P = [tuple(map(int, input().split())) for i in range(N)] X = [x + y for x, y in P] Y = [x - y for x, y in P] print(max(max(X) - min(X), max(Y) - min(Y)))
p02556
s518784482
Accepted
import sys input=sys.stdin.readline N=int(input()) m=[] a=[-float("inf"), float("inf")] b=[-float("inf"), float("inf")] for _ in range(N): x, y = map(int, input().split()) a[0] = max(a[0], x+y) a[1] = min(a[1], x+y) b[0] = max(b[0], x-y) b[1] = min(b[1], x-y) print(max(abs(a[0]-a[1]), abs(b[0]-b[1])))
p02556
s100611251
Accepted
N = int(input()) def dist(A, B): return abs(A[0] - B[0]) + abs(A[1] - B[1]) XY = [tuple(map(int, input().split())) for _ in range(N)] INF = -10**10 ans = 0 for O in [(INF, INF), (-INF, INF)]: S = XY[0] for xy in XY: if dist(O, S) < dist(O, xy): S = xy O = S for xy in XY: if dist(O, S) < dist(O, xy): S = xy ans = max(ans, dist(O, S)) print(ans)
p02556
s367328336
Accepted
#!/usr/bin/env python3 import sys input=sys.stdin.readline n=int(input()) xs=[] ys=[] for _ in range(n): x,y=map(int,input().split()) tx,ty=x+y,x-y xs.append(tx) ys.append(ty) xs=sorted(xs) ys=sorted(ys) ans=max(abs(xs[-1]-xs[0]),abs(ys[-1]-ys[0])) print(ans)
p02556
s676945763
Accepted
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def main(): N = int(readline()) m = map(int,read().split()) XY = list(zip(m,m)) ans = 0 z = [x-y for (x, y) in XY] # print(z) z.sort() ans = z[-1] - z[0] z = [x+y for (x, y) in XY] # print(z) z.sort() ans = max(ans, z[-1] - z[0]) print(ans) if __name__ == '__main__': main()
p02556
s950248821
Accepted
#!/usr/bin/env python3 import sys input=sys.stdin.readline n=int(input()) xs=[] ys=[] for _ in range(n): x,y=map(int,input().split()) tx,ty=x+y,x-y xs.append(tx) ys.append(ty) xs=sorted(xs) ys=sorted(ys) ans=max(abs(xs[-1]-xs[0]),abs(ys[-1]-ys[0])) print(ans)
p02556
s348813566
Accepted
n=int(input()) s=[] t=[] for i in range(n): x,y=map(int,input().split()) s.append(x+y) t.append(x-y) print(max(max(s)-min(s),max(t)-min(t)))
p02556
s128845271
Accepted
n = int(input()) x = [0]*n for i in range(n): x[i] = list(map(int,input().split())) d0 = [0]*n d1 = [0]*n for i,[x,y] in enumerate(x) : d0[i] = x-y d1[i] = x+y print(max(max(d0)-min(d0), max(d1)-min(d1)))
p02556
s992132267
Accepted
N=int(input()) point=list() for i in range(N): point.append([int(i) for i in input().split()]) #print(point) list_a=sorted(point,key=lambda x:x[0]+x[1]) list_b=sorted(point,key=lambda x:x[1]-x[0]) ps=[list_a[0],list_a[N-1],list_b[0],list_b[N-1]] #print(ps) ans=0 for p1 in ps: for p2 in ps: ans=max(ans,abs(p1[0]-p2[0])+abs(p1[1]-p2[1])) print (ans)
p02556
s195517073
Accepted
N=int(input()) A=[] B=[] for _ in range(N): x,y=map(int, input().split()) A.append(x+y) B.append(x-y) A=sorted(A) B=sorted(B) print(max(A[-1]-A[0],B[-1]-A[0],A[-1]-A[0],B[-1]-B[0]))
p02556
s112863314
Accepted
n = int(input()) xy_array = [list(map(int, input().split())) for _ in range(n)] th = pow(10, 9) z_max = -th z_min = th w_max = -th w_min = th for x, y in xy_array: z_max = max(x + y, z_max) z_min = min(x + y, z_min) w_max = max(x - y, w_max) w_min = min(x - y, w_min) ans = max(z_max - z_min, w_max - w_min) print(ans)
p02556
s240818034
Accepted
N = int(input()) coords, minus, plus = [], [], [] for _ in range(N): x, y = map(int,input().split()) coords.append([x,y]) minus.append(x-y) plus.append(x+y) minus.sort() plus.sort() ans = 0 for x, y in coords: now_minus, now_plus = x-y, x+y ans = max(ans, abs(now_minus-minus[0]), abs(now_minus-minus[-1])) ans = max(ans, abs(now_plus-plus[0]), abs(now_plus-plus[-1])) print(ans)
p02556
s504777180
Accepted
n = int(input()) xy=[list(map(int,input().split())) for i in range(n)] d1 = [] d2 = [] for x,y in xy: d1.append(x-y) d2.append(x+y) ans1=max(d1)-min(d1) ans2=max(d2)-min(d2) print(max(ans1,ans2))
p02556
s584931150
Accepted
n=int(input()) ans=[] ans1=[] for _ in range(n): a,b=map(int,input().split()) d=a-b c=a+b ans.append(c) ans1.append(d) m=min(ans) M=max(ans) P=M-m Q=max(ans1)-min(ans1) print(max(P,Q))
p02556
s482186121
Accepted
n= int(input()) a = [list(map(int, input().split())) for i in range(n)] b = [] c = [] for i in range(n): b.append(a[i][0]+a[i][1]) c.append(a[i][0]-a[i][1]) maxbc=[max(b)-min(b), max(c)-min(c)] print(max(maxbc))
p02556
s515937165
Accepted
n = int(input()) l = [[] for i in range(4)] for i in range(n): x, y = map(int, input().split()) l[0].append(x+y) l[1].append(x-y) l[2].append(-x+y) l[3].append(-x-y) for i in range(4): l[i].sort() ans = 0 for i in range(4): ans = max(ans, l[i][-1] - l[i][0]) print(ans)
p02556
s588835814
Accepted
from sys import stdin n=int(input()) D1=[] D2=[] for _ in range(n): x, y= map(int, stdin.readline().split()) r1=x+y r2=abs((10**9-x)+y) D1.append(r1) D2.append(r2) ans1=max(D1)-min(D1) ans2=max(D2)-min(D2) print(max(ans1,ans2))
p02556
s896861179
Accepted
N = int(input()) minus = [] plus = [] for _ in range(N): x, y = map(int, input().split()) minus.append(x-y) plus.append(x+y) print(max(max(minus) - min(minus), max(plus) - min(plus)))
p02556
s583277525
Accepted
N=int(input()) A=[0]*(N) B=[0]*(N) for i in range(N): x,y=map(int, input().split()) A[i]=x+y B[i]=x-y A=sorted(A) B=sorted(B) print(max(A[-1]-A[0],B[-1]-A[0],A[-1]-A[0],B[-1]-B[0]))
p02556
s942441060
Accepted
N = int(input()) xy = [] xplusy = [] xminusy = [] for i in range(N): x, y = map(int, input().split()) xplusy.append(x+y) xminusy.append(x-y) ans1 = max(xplusy) - min(xplusy) ans2 = max(xminusy) - min(xminusy) print(max(ans1, ans2))
p02556
s965562623
Accepted
n = int(input()) xy = list(list(map(int, input().split())) for _ in range(n)) #print(n, xy) x_minus_y = [] x_plus_y = [] for i in range(n): x_minus_y.append(xy[i][0] - xy[i][1]) x_plus_y.append(xy[i][0] + xy[i][1]) x_max = max(x_minus_y) x_min = min(x_minus_y) y_max = max(x_plus_y) y_min = min(x_plus_y) if x_max - x_min >= y_max - y_min: print(x_max - x_min) else: print(y_max - y_min)
p02556
s122897575
Accepted
from collections import deque N=int(input()) L1=[0 for _ in range(N)] L2=[0 for _ in range(N)] for i in range(N): x,y=map(int,input().split()) L1[i],L2[i]=x-y,x+y mi1=min(L1) ma1=max(L1) mi2=min(L2) ma2=max(L2) ans=max(ma1-mi1,ma2-mi2) print(ans)
p02556
s604601532
Accepted
n = int(input()) mi1= 10**10 ma1= -10**10 mi2=10**10 ma2=-10**10 P = [] for i in range(n): a = list(map(int,input().split())) P.append(a) P.sort(key = lambda x:x[0]) for i in range(n): p=P[i] mi1=min(mi1,p[0]+p[1]) ma1=max(ma1,p[0]+p[1]) mi2=min(mi2,p[0]-p[1]) ma2=max(ma2,p[0]-p[1]) print(max(ma1-mi1,ma2-mi2))
p02556
s887457637
Accepted
N=int(input()) Z=[0]*N W=[0]*N for i in range(N): x, y = map(int, input().split()) Z[i]=x+y W[i]=x-y print(max(max(Z)-min(Z),max(W)-min(W)))
p02556
s714096266
Accepted
n = int(input()) Xs = [] Ys = [] for _ in range(n): x, y = map(int, input().split()) Xs.append(x+y) Ys.append(x-y) Xs.sort() Ys.sort() print(max(Xs[-1]-Xs[0], Ys[-1]-Ys[0]))
p02556
s530148872
Accepted
n = int(input()) xx = [] yy = [] for _ in range(n): x, y = map(int, input().split()) xx.append(x + y) yy.append(x - y) print(max(max(xx) - min(xx), max(yy) - min(yy)))
p02556
s923518651
Accepted
n = int(input()) a, b = map(int, input().split()) mini = a+b maxi = a+b mini1 = a-b maxi1 = a-b for i in range(n-1): a, b = map(int, input().split()) mini = min(a+b, mini) maxi = max(a+b, maxi) mini1 = min(a-b, mini1) maxi1 = max(a-b, maxi1) ans = max(maxi-mini, maxi1-mini1) print(ans)
p02556
s044444932
Accepted
N = int(input()) xy = [list(map(int, input().split())) for i in range(N)] z = [x + y for x, y in xy] w = [x - y for x, y in xy] print(max(max(z) - min(z), max(w) - min(w)))
p02556
s477879144
Accepted
N=int(input()) L=[list(map(int,input().split())) for i in range(N)] zmax=zmin=L[0][0]+L[0][1] wmax=wmin=L[0][0]-L[0][1] for a,b in L: z,w=a+b,a-b zmax=max(zmax,z) zmin=min(zmin,z) wmax=max(wmax,w) wmin=min(wmin,w) print(max(zmax-zmin,wmax-wmin))
p02556
s127223918
Accepted
n=int(input()) ad=[0]*n su=[0]*n for i in range(n): x,y=map(int,input().split()) ad[i]=x+y su[i]=x-y ad.sort() su.sort() print(max(ad[-1]-ad[0],su[-1]-su[0]))
p02556
s425179771
Accepted
N=int(input()) X=[list(map(int,input().split())) for i in range(N)] for i in range(N): X[i]=[X[i][0]+X[i][1],X[i][0]-X[i][1]] print(max([max([X[i][j] for i in range(N)])-min([X[i][j] for i in range(N)]) for j in range(2)]))
p02556
s288788515
Accepted
N = int(input()) a,b = [], [] for i in range(N): x,y = map(int, input().split()) a.append(x-y) b.append(x+y) a.sort() b.sort() ans = max(a[-1] - a[0], b[-1] - b[0]) print(ans)
p02556
s585588111
Accepted
N = int(input()) A=[]; B= [] for i in range(N): a,b = map(int,input().split()) A.append((a+b)) B.append((a-b)) A.sort() B.sort() ans = max(A[-1]-A[0],B[-1]-B[0]) print(ans)
p02556
s383970098
Accepted
z = [] w = [] for _ in range(int(input())): x, y = map(int, input().split()) z.append(x + y) w.append(x - y) z_max = max(z) z_min = min(z) w_max = max(w) w_min = min(w) print(max([abs(z_max - z_min), abs(w_max - w_min)]))
p02556
s009547369
Accepted
import numpy as np N = int(input()) x = [] y = [] xy1 = [] xy2 = [] for i in range(N): a, b = (int(t) for t in input().split()) x.append(a) y.append(b) xy1.append(a + b) xy2.append(a - b) max1 = max(xy1) - min(xy1) max2 = max(xy2) - min(xy2) print(max((max1, max2)))
p02556
s654138245
Accepted
n = int(input()) point_dict1 = {} point_dict2 = {} for i in range(n): x, y = map(int, input().split()) point_dict1[x + y] = (x, y) point_dict2[y - x] = (x, y) min_point1 = min(point_dict1) max_point1 = max(point_dict1) min_point2 = min(point_dict2) max_point2 = max(point_dict2) print(max(max_point1 - min_point1, max_point2 - min_point2))
p02556
s768039787
Accepted
import sys input = sys.stdin.readline N = int(input()) points = [0] * N rx = [] ry = [] for i in range(N): x, y = map(int, input().split()) rx.append(x - y) ry.append(x + y) print(max(max(rx) - min(rx), max(ry) - min(ry)))
p02556
s191233760
Accepted
import sys input = sys.stdin.readline n = int(input()) max_pp = -2 * 10**10 min_pp = 2 * 10**10 max_pn = -2 * 10**10 min_pn = 2 * 10**10 for i in range(n): x, y = map(int, input().split()) max_pp = max(max_pp, x + y) min_pp = min(min_pp, x + y) max_pn = max(max_pn, x - y) min_pn = min(min_pn, x - y) print(max(max_pp - min_pp, max_pn - min_pn))
p02556
s574950400
Accepted
N=int(input()) xy = [map(int, input().split()) for _ in range(N)] x, y = [list(i) for i in zip(*xy)] xyp=[] xym=[] for i in range(N): xyp.append(x[i]+y[i]) xym.append(x[i]-y[i]) print(max(max(xyp)-min(xyp),-min(xym)+max(xym),max(xym)-min(xym),-min(xym)+max(xym)))
p02556
s949970859
Accepted
n = int(input()) d1 = [] d2 = [] for i in range(n): x,y = map(int,input().split()) d1.append(x-y) d2.append(x+y) one = max(d1)-min(d1) two = max(d2)-min(d2) print(max(one,two))
p02556
s015155043
Accepted
n = int(input()) x = [0] * n y = [0] * n for i in range(n): x[i], y[i] = map(int, input().split()) z = [0] * n w = [0] * n for i in range(n): z[i] = x[i] + y[i] w[i] = x[i] - y[i] cand1 = max(z) - min(z) cand2 = max(w) - min(w) print(max(cand1, cand2))
p02556
s143423860
Accepted
sumi=[] diff=[] t=int(input()) for _ in range(t): z=list(map(int,input().split())) sumi.append(z[0]+z[1]) diff.append(z[0]-z[1]) print (max(max(diff)-min(diff),max(sumi)-min(sumi)))
p02556
s668209709
Accepted
n = int(input()) max_XminusY = -float('inf') min_XminusY = float('inf') max_XplusY = -float('inf') min_XplusY = float('inf') for _ in range(n): x, y = map(int, input().split()) max_XminusY = max(max_XminusY, x - y) min_XminusY = min(min_XminusY, x - y) max_XplusY = max(max_XplusY, x + y) min_XplusY = min(min_XplusY, x + y) print(max(abs(max_XminusY - min_XminusY), abs(max_XplusY - min_XplusY)))
p02556
s517102178
Accepted
N = int(input()) # マンハッタン距離 plus = [] minus = [] for _ in range(N): x, y = map(int, input().split()) plus.append(x + y) minus.append(x - y) print(max(max(plus) - min(plus), max(minus) - min(minus)))
p02556
s311106730
Accepted
import sys input = sys.stdin.readline N = int(input()) xy = [list(map(int,input().split())) for i in range(N)] xy.sort() xy2 = [(x-y,x+y) for x,y in xy] xd, yd = zip(*xy2) dx = max(xd) - min(xd) dy = max(yd) - min(yd) print(max(dx,dy))
p02556
s411669896
Accepted
N = int(input()) x, y = map(int, input().split()) A = [x + y, x + y, y - x, y - x] for i in range(N - 1): x, y = map(int, input().split()) p = x + y q = y - x A[0] = max(A[0], p) A[1] = min(A[1], p) A[2] = max(A[2], q) A[3] = min(A[3], q) print(max(A[0] - A[1], A[2] - A[3]))
p02556
s466619430
Accepted
n=int(input()) a=[] b=[] for i in range(n): x,y= map(int,input().split()) a.append(y-x) b.append(x+y) a.sort() b.sort() print(max(a[-1]-a[0], b[-1]-b[0]))
p02556
s250619290
Accepted
n = int(input()) maxx, minx, maxy, miny = -10 ** 10, 10 ** 10, -10 ** 10, 10 ** 10 for i in range(n): x, y = map(int, input().split()) x, y = x + y, x - y maxx = max(x, maxx) minx = min(x, minx) maxy = max(y, maxy) miny = min(y, miny) print(max(maxx - minx, maxy - miny))
p02556
s140297921
Accepted
from collections import deque N = int(input()) AM, Am, BM, Bm = -1*10**9*2, 10**9*2, -1*10**9*2, 10**9*2 for _ in range(N): x, y = map(int, input().split()) AM = max(AM, x+y) Am = min(Am, x+y) BM = max(BM, x-y) Bm = min(Bm, x-y) print(max(AM-Am, BM-Bm))
p02556
s822672493
Accepted
n=int(input()) a=[] b=[] for i in range(n): x,y=map(int,input().split()) a.append(x+y) b.append(x-y) print(max(max(a)-min(a),max(b)-min(b)))
p02556
s564565472
Accepted
N = int(input()) za = [] for _ in range(N): x, y = map(int,input().split()) za.append((x + y, y - x)) X = max(za, key = lambda x:x[0])[0] - min(za, key = lambda x:x[0])[0] Y = max(za, key = lambda x:x[1])[1] - min(za, key = lambda x:x[1])[1] print(max(X, Y))
p02556
s642353789
Accepted
import sys,math,collections,itertools input = sys.stdin.readline N=int(input()) zmax=-float('inf') zmin = float('inf') wmax = -float('inf') wmin = float('inf') for _ in range(N): x,y=map(int,input().split()) z=x+y w=x-y zmax = max(z,zmax) zmin = min(z,zmin) wmax = max(w,wmax) wmin = min(w,wmin) print(max(zmax-zmin,wmax-wmin))
p02556
s856901060
Accepted
N=int(input()) x=[] y=[] for i in range(N): b,c=map(int,input().split(" ")) x.append(b+c) y.append(b-c) print(max([max(x)-min(x),max(y)-min(y)]))
p02556
s619803734
Accepted
''' Created on 2020/09/14 @author: harurun ''' def main(): import sys pin=sys.stdin.readline pout=sys.stdout.write perr=sys.stderr.write N=int(pin()) x,y=map(int,pin().split()) z1=x+y z2=x+y w1=x-y w2=x-y for i in range(N-1): x,y=map(int,pin().split()) z1=max(z1,x+y) z2=min(z2,x+y) w1=max(w1,x-y) w2=min(w2,x-y) print(max(z1-z2,w1-w2)) return main() #解説AC
p02556
s709198697
Accepted
n=int(input()) r=[list(map(int,input().split())) for _ in range(n)] a,c,b,d=0,10**10,0,10**10 for i in range(n): y,x=r[i] a=max(a,x+y) c=min(c,x+y) b=max(b,x-y) d=min(d,x-y) print(max(abs(a-c),abs(b-d)))
p02556
s049470251
Accepted
N = int(input()) xs, ys = [], [] for _ in range(N): x, y = map(int, input().split()) xs.append(x) ys.append(y) U = [x + y for x, y in zip(xs, ys)] V = [x - y for x, y in zip(xs, ys)] ans = max([max(U) - min(U), max(V) - min(V)]) print(ans)