problem_id
stringclasses
100 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
6
806
p02556
s298063965
Accepted
def main(): # start coding here... N = int(input()) a = [] b = [] for i in range(N): x,y = map(int,input().split()) a.append(x+y) b.append(x-y) ans = max(max(a)-min(a),max(b)-min(b)) print(ans) if __name__ == "__main__": main()
p02556
s293583458
Accepted
#!/usr/bin/env python n = int(input()) x_plus_y = [0 for _ in range(n)] x_minus_y = [0 for _ in range(n)] for i in range(n): x, y = map(int, input().split()) x_plus_y[i] = x+y x_minus_y[i] = x-y ans = max(max(x_plus_y)-min(x_plus_y), max(x_minus_y)-min(x_minus_y)) print(ans)
p02556
s070918982
Accepted
N = int(input()) points = [list(map(int, input().split())) for _ in range(N)] INF = 10**10 xmax = -INF xmin = INF ymax = -INF ymin = INF for x, y in points: minus = x-y plus = x+y xmax = max(xmax, minus) xmin = min(xmin, minus) ymax = max(ymax, plus) ymin = min(ymin, plus) print(max(xmax-xmin, ymax-ymin))
p02556
s179032875
Accepted
def main(): N = int(input()) X = [] Y = [] for _ in range(N): x, y = (int(i) for i in input().split()) X.append(x + y) Y.append(x - y) ans = max(max(X) - min(X), max(Y) - min(Y)) print(ans) if __name__ == '__main__': main()
p02556
s162163840
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 a = max(z) b = min(z) c = max(w) d = min(w) print(max(a-b, b-a, c-d, d-c))
p02556
s877332608
Accepted
#E_Manhattan 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
s221419830
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
s844032301
Accepted
N = int(input()) xy = [] for i in range(N): xy.append(list(map(int, input().split()))) def f(x, y): return [x - y, x + y] XY = [] for x, y in xy: XY.append(f(x, y)) large, small = [-float('inf'), -float('inf')], [float('inf'), float('inf')] for i in range(2): for j in XY: large[i] = max(j[i], large[i]) small[i] = min(j[i], small[i]) ans = max(large[0] - small[0], large[1] - small[1]) print(ans)
p02556
s726989220
Accepted
n = int(input()) X_min = float("inf") X_max = -float("inf") Y_min = float("inf") Y_max = -float("inf") for _ in range(n): x, y = map(int, input().split()) X = x - y Y = x + y X_min = min(X_min, X) X_max = max(X_max, X) Y_min = min(Y_min, Y) Y_max = max(Y_max, Y) print(max(X_max-X_min, Y_max-Y_min))
p02556
s687346351
Accepted
import sys input = sys.stdin.readline N=int(input()) P=[tuple(map(int,input().split())) for i in range(N)] PLUS=[] MINUS=[] for x,y in P: PLUS.append(x+y) MINUS.append(x-y) PLUS.sort() MINUS.sort() print(max(PLUS[-1]-PLUS[0],MINUS[-1]-MINUS[0]))
p02556
s429334354
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.sort() B.sort() print(max(A[N-1]-A[0],abs(B[N-1]-B[0])))
p02556
s326257619
Accepted
def get_ints(): return list(map(int, input().split())) n = int(input()) a,b = [],[] for i in range(n): x, y = get_ints() 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
s084106144
Accepted
N = int(input()) L = [[int(l) for l in input().split()] for _ in range(N)] L1 = [0]*N L2 = [0]*N for i in range(N): L1[i] = L[i][0]+L[i][1] L2[i] = L[i][0]-L[i][1] L1.sort() L2.sort() print(max(L1[-1]-L1[0], L2[-1]-L2[0]))
p02556
s674778215
Accepted
import math n = int(input()) x = list(range(n)) y = list(range(n)) m = list(range(n)) l = list(range(n)) for i in range(n): x[i],y[i] = map(int,input().split()) m[i] = x[i] - y[i] l[i] = x[i] + y[i] m.sort() l.sort() res = max(m[n-1]-m[0], l[n-1]-l[0]) print(res)
p02556
s169504517
Accepted
m,*p=[], for i in [*open(0)][1:]:x,y=map(int,i.split());m+=x-y,;p+=x+y, a=max;print(a(a(m)-min(m),a(p)-min(p)))
p02556
s105512191
Accepted
n = int(input()) pmax = 0 pmin = 0 mmax = 0 mmin = 0 for i in range(n): x, y = map(int, input().split()) if(i ==0 or pmax < x + y): pmax = x+y if(i == 0 or pmin > x+y): pmin = x+y if(i == 0 or mmax < x-y): mmax = x-y if(i == 0 or mmin > x-y): mmin = x-y print(max(pmax - pmin, mmax - mmin))
p02556
s053378802
Accepted
import numpy as np def solve(n, x, y): x = np.asarray(x) y = np.asarray(y) z = x + y w = x - y return max(np.max(z) - np.min(z), np.max(w) - np.min(w)) n = int(input()) x, y = zip(*[map(int, input().split()) for i in range(n)]) print(solve(n, x, y))
p02556
s658304007
Accepted
import sys import math,bisect sys.setrecursionlimit(10 ** 5) from collections import defaultdict from itertools import groupby,accumulate from heapq import heapify,heappop,heappush from collections import deque,Counter,OrderedDict def I(): return int(sys.stdin.readline()) def neo(): return map(int, sys.stdin.readline().split()) def Neo(): return list(map(int, sys.stdin.readline().split())) n = I() A,B = [],[] for i in range(n): a,b = neo() A += [a+b] B += [a-b] A.sort() B.sort() Ans = max(A[-1]-A[0],B[-1]-B[0]) print(Ans)
p02556
s360056663
Accepted
n = int(input()) pointx = [] pointy = [] for i in range(n): x, y = map(int, input().split()) pointx.append(x-y) pointy.append(x+y) print(max(max(pointx)-min(pointx),(max(pointy)-min(pointy))))
p02556
s076242958
Accepted
import sys input = sys.stdin.readline N = int(input()) mn = 10 ** 10 mx = -10 ** 10 mn2 = 10 ** 10 mx2 = -10 ** 10 qs = [tuple(map(int, input().split())) for _ in range(N)] qs.sort() for i in range(N): x, y = qs[i] mn = min(mn, x + y) mx = max(mx, x + y) mn2 = min(mn2, x - y) mx2 = max(mx2, x - y) print(max(abs(mx2 - mn2), abs(mx - mn)))
p02556
s621735732
Accepted
def LI(): return list(map(int, input().split())) pu = [] mi = [] N = int(input()) for _ in range(N): x, y = LI() pu.append(x+y) mi.append(x-y) P = max(pu) p = min(pu) M = max(mi) m = min(mi) print(max(P-p, M-m))
p02556
s505834915
Accepted
n = int(input()) x_max = 0 y_max = 0 x_min = 10**9 y_min = 10**9 p_arr = [0]*n m_arr = [0]*n for i in range(n): x, y = map(int, input().split()) p_arr[i] = x + y m_arr[i] = x - y p_dist = max(p_arr) - min(p_arr) m_dist = max(m_arr) - min(m_arr) dist_max = max(p_dist, m_dist) print(dist_max)
p02556
s569956118
Accepted
n = int(raw_input()) points = set([]) for _ in range(n): p = map(int, raw_input().split()) points.add(tuple(p)) points = list(points) def distance(p,q): return abs(p[0] - q[0]) + abs(p[1] - q[1]) def f(points): r = 0 for u in [-1,1]: for v in [-1,1]: pps = [u*x + v*y for x,y in points] r = max(r, max(pps) - min(pps)) return r print f(points)
p02556
s391241365
Accepted
n = int(input()) xy = [list(map(int, input().split())) for _ in range(n)] xy.sort() lstm = [] lstp = [] for x, y in xy: lstm.append(x-y) lstp.append(x+y) lstm.sort() lstp.sort() ans = max(lstm[-1] - lstm[0], lstp[-1] - lstp[0]) print(ans)
p02556
s540156749
Accepted
n = int(input()) p = [list(map(int, input().split())) for _ in range(n)] q = [[x+y, x-y] for x, y in p] print(max(max(q)[0] - min(q)[0], max(q, key=lambda x: x[1])[1] - min(q, key=lambda x: x[1])[1]))
p02556
s001188265
Accepted
n=int(input()) INF=float('inf') cmin0,cmax0=INF,-INF cmin1,cmax1=INF,-INF for _ in range(n): x,y=map(int,input().split()) cx,cy=x-y,x+y cmin0=min(cmin0,cx) cmax0=max(cmax0,cx) cmin1=min(cmin1,cy) cmax1=max(cmax1,cy) ans=max(cmax0-cmin0,cmax1-cmin1) print(ans)
p02556
s244199899
Accepted
n = int(input()) xyl = [tuple(map(int, input().split())) for _ in range(n)] xyp = [] xym = [] for x,y in xyl: xyp.append(x+y) xym.append(x-y) # xyp.sort() # xym.sort() ans1 = max(xym)-min(xym) # print(ans1) ans2 = max(xyp)-min(xyp) ans = max(ans1,ans2) print(ans)
p02556
s206397145
Accepted
N = int(input()) xy = [tuple(map(int, input().split())) for _ in range(N)] z = []; w = [] for x, y in xy: z.append(x + y) w.append(x - y) print(max(max(z)-min(z), max(w)-min(w)))
p02556
s561765751
Accepted
N = int(input()) px = [] py = [] cro1 = [] cro2 = [] for i in range(N): x,y = map(int,input().split()) px.append((x,y)) py.append((x,y)) cro1.append(x+y) cro2.append(y-x) """ px.sort() py.sort(key=lambda x:x[1]) """ cro1.sort() cro2.sort() print(max(cro1[-1]-cro1[0],cro2[-1]-cro2[0]))
p02556
s326315530
Accepted
import sys n = int(sys.stdin.buffer.readline()) z, w = [0]*n, [0]*n for a, i in zip(sys.stdin.buffer.readlines(), range(n)): x, y = map(int, a.split()) z[i] = x+y w[i] = x-y print(max(abs(max(z)-min(z)), abs(max(w)-min(w))))
p02556
s620809675
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
s779060113
Accepted
n=int(input()) a=[] j=k=0 def s(a): return a[0]+a[1] def ss(a): return a[0]-a[1] for i in range(n): f=list(map(int,input().split())) a.append(f) aa=min(map(s,a)) b=max(map(s,a)) c=min(map(ss,a)) d=max(map(ss,a)) print(max(abs(d-c),abs(b-aa)))
p02556
s506965811
Accepted
n = int(input()) u = [list(map(int, input().split())) for i in range(n)] z = [u[i][0] + u[i][1] for i in range(n)] w = [u[i][0] - u[i][1] for i in range(n)] d = [max(z)-min(z), max(w)-min(w)] print(max(d))
p02556
s920389510
Accepted
x=[];y=[] for _ in range(int(input())): a,b=map(int,input().split()) x.append(a-b);y.append(a+b) print(max(max(x)-min(x),max(y)-min(y)))
p02556
s682857648
Accepted
N = int(input()) pulls = [] minus = [] for _ in range(N): x, y = map(int, input().split()) pulls += [x+y] minus += [x-y] pulls.sort() minus.sort() print(max(pulls[-1] - pulls[0], minus[-1] - minus[0]))
p02556
s204336021
Accepted
import sys readline = sys.stdin.readline N = int(readline()) A = [] B = [] for _ in range(N): x, y = map(int, readline().split()) A.append(x-y) B.append(x+y) print(max(max(A) - min(A), max(B) - min(B)))
p02556
s855813218
Accepted
n = int (input()) xy = [] def dist(a, b): return abs(a[0]-b[0]) + abs(a[1]-b[1]) for i in range(n): x, y = map(int,input().split()) xy.append([x+y, x-y]) xy.sort(key = lambda x: x[0]) min_z = xy[0][0] max_z = xy[-1][0] xy.sort(key = lambda x: x[1]) min_w = xy[0][1] max_w = xy[-1][1] print(max(abs(min_z - max_z), abs(min_w - max_w)))
p02556
s897674918
Accepted
N = int(input()) XYs = [[],[]] for _ in range(N): x,y = map(int, input().split()) XYs[0].append(x-y) XYs[1].append(x+y) print(max(max(XYs[0])-min(XYs[0]), max(XYs[1])-min(XYs[1])))
p02556
s571536882
Accepted
n = int(input()) xpy_max = -1001001001 xpy_min = 1001001001 xmy_max = -1001001001 xmy_min = 1001001001 for i in range(n): x, y = map(int, input().split()) xpy_max = max(xpy_max, x+y) xpy_min = min(xpy_min, x+y) xmy_max = max(xmy_max, x-y) xmy_min = min(xmy_min, x-y) ans = max(xpy_max - xpy_min, xmy_max - xmy_min) print(ans)
p02556
s837110163
Accepted
import sys input = sys.stdin.readline N = int(input()) xy = [] xs = [] ys = [] for _ in range(N): x, y = map(int, input().split()) xy.append([x - y, x + y]) xs.append(x - y) ys.append(x + y) diff1 = max(xs) - min(xs) diff2 = max(ys) - min(ys) ans = max(diff1, diff2) print(ans)
p02556
s311355905
Accepted
n = int(input()) xmi = 1e18 xma = -1e18 ymi = 1e18 yma = -1e18 for i in range(n): x, y = map(int, input().split()) xmi = min(xmi, x+y) xma = max(xma, x+y) ymi = min(ymi, x-y) yma = max(yma, x-y) ans = 0 ans = max(ans, xma - xmi) ans = max(ans, yma - ymi) print(ans)
p02556
s310442851
Accepted
import sys def input(): return sys.stdin.readline()[:-1] 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
s719221024
Accepted
import sys def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) N = I() A,B = [],[] # x+y,x-y たちのリスト for i in range(N): x,y = MI() A.append(x+y) B.append(x-y) print(max(max(A)-min(A),max(B)-min(B)))
p02556
s581537535
Accepted
N = int(input()) X = [0]*N Y = [0]*N for TN in range(0,N): A,B = (int(T) for T in input().split()) X[TN] = A-B Y[TN] = A+B print(max(max(X)-min(X),max(Y)-min(Y)))
p02556
s522977601
Accepted
n = int(input()) k = [0] * n l = [0] * n for i in range(n): x, y = [int(i) for i in input().split()] k[i] = x + y l[i] = x - y print(max(max(k)-min(k), max(l)-min(l)))
p02556
s117325076
Accepted
n = int(input()) xy = [list(map(int, input().split())) for _ in range(n)] def f(x): return x[0]-x[1] def g(x): return x[0]+x[1] ans = max(f(max(xy, key=f))-f(min(xy, key=f)), g(max(xy, key=g))-g(min(xy, key=g)),) print(ans)
p02556
s571703216
Accepted
n = int(input()) xy = [list(map(int, input().split())) for _ in range(n)] xzy = [] for _ in range(4): xzy.append([]) for x, y in xy: xzy[0].append(x + y) xzy[1].append(x - y) xzy[2].append(-x + y) xzy[3].append(-x - y) anses = [] for z in xzy: anses.append(max(z) - min(z)) print(max(anses))
p02556
s125086395
Accepted
N=int(input()) x=[list(map(int,input().split())) for _ in range(N)] A=[] B=[] C=[] D=[] for i in range(N): A.append(x[i][0]+x[i][1]) B.append(-x[i][0]-x[i][1]) C.append(x[i][0]-x[i][1]) D.append(-x[i][0]-x[i][1]) print(max(max(A)-min(A),max(B)-min(B),max(C)-min(C),max(D)-min(D)))
p02556
s948950356
Accepted
#!/usr/bin/env python3 import sys def main(): input = sys.stdin.readline n = int(input()) Z = [] W = [] for _ in range(n): x, y = map(int, input().split()) z = x + y w = x - y Z.append(z) W.append(w) Z.sort() W.sort() print(max(abs(Z[0] - Z[-1]), abs(W[0] - W[-1]))) if __name__ == '__main__': main()
p02556
s236155908
Accepted
N = int(input()) xy = [list(map(int,input().split())) for _ in range(N)] ma = -float('inf') mi = float('inf') for x,y in xy: ma = max(ma,x-y) mi = min(mi,x-y) ans = ma - mi ma = -float('inf') mi = float('inf') for x,y in xy: ma = max(ma,x+y) mi = min(mi,x+y) ans = max(ans, ma - mi) print(ans)
p02556
s557475252
Accepted
import numpy as np N = int(input()) XY_set = np.array(list(set(tuple(map(int, input().split())) for _ in range(N)))) XpY = XY_set[:, 0] + XY_set[:, 1] XmY = XY_set[:, 0] - XY_set[:, 1] ans = max(XpY.max() - XpY.min(), XmY.max() - XmY.min()) print(ans)
p02556
s924774834
Accepted
N = int(input()) Array1 = [] Array2 = [] for i in range(N): next_x, next_y = map(int, input().split()) s = next_x + next_y t = next_x - next_y Array1.append(s) Array2.append(t) print(max(max(Array1)-min(Array1),max(Array2)-min(Array2)))
p02556
s732080245
Accepted
N = int(input()) L = [10**10]*4 for _ in range(N): x,y = [int(i) for i in input().split()] L[0] = min(L[0],x+y) L[1] = min(L[1],x-y+10**9) L[2] = min(L[2],-x+y+10**9) L[3] = min(L[3],-x-y+2*(10**9)) print(max(2*(10**9)-L[0]-L[3],2*(10**9)-L[1]-L[2]))
p02556
s387298905
Accepted
def main(): N = int(input()) X, Y = [], [] for _ in range(N): x, y = map(int, input().split()) X.append(x - y) Y.append(x + y) return max(max(X) - min(X), max(Y) - min(Y)) print(main())
p02556
s619151066
Accepted
def get_ints(): return list(map(int,input().split())) n = int(input()) a,b = [],[] for i in range(n): x,y = get_ints() 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
s329740558
Accepted
n = int(input()) for i in range(n): x,y = map(int,input().split()) if i == 0: summax = x+y summin = x+y diffmax = x-y diffmin = x-y if x+y > summax: summax = x+y if x+y < summin: summin = x+y if x-y > diffmax: diffmax = x-y if x-y < diffmin: diffmin = x-y a = summax-summin b = diffmax-diffmin sol = max(a,b) print(sol)
p02556
s811355062
Accepted
import sys input = sys.stdin.readline N = int(input()) xy = [[int(i) for i in input().split()] for _ in range(N)] d1 = [] d2 = [] for x, y in xy : d1.append(x + y) d2.append(x - y) d1.sort(reverse=True) d2.sort(reverse=True) print(max( d1[0] - d1[-1], d2[0] - d2[-1], ))
p02556
s060964474
Accepted
def main(): n = int(input()) d1 = [] d2 = [] for _ in range(n): x, y = map(int, input().split()) d1.append(x + y) d2.append(x - y) d1.sort() d2.sort() print(max(d1[-1] - d1[0], d2[-1] - d2[0])) if __name__ == '__main__': main()
p02556
s235589615
Accepted
n = int(input()) p = [0 for _ in range(n)] m = [0 for _ in range(n)] for i in range(n): xi,yi = map(int,input().split()) p[i] = xi+yi m[i] = xi-yi p.sort() m.sort() print(max(p[-1] - p[0],m[-1] - m[0]))
p02556
s134583516
Accepted
N=int(input()) xy=[tuple(map(int,input().split())) for _ in range(N)] ans=0 zmi=10**10 zma=-10**10 wmi=10**10 wma=-10**10 for x,y in xy: zmi=min(zmi,x+y) zma=max(zma,x+y) wmi=min(wmi,x-y) wma=max(wma,x-y) print(max(zma-zmi,wma-wmi))
p02556
s384689775
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) xm = max(rx) xn = min(rx) ym = max(ry) yn = min(ry) ans = max(max(xm - x, x - xn, ym - y, y - yn) for x, y in zip(rx, ry)) print(ans)
p02556
s820363724
Accepted
N = int(input()) L = [tuple(map(int, input().split())) for _ in range(N)] L.sort(key=lambda x: x[0]+x[1]) a = abs(L[0][0]-L[-1][0])+abs(L[0][1]-L[-1][1]) L.sort(key=lambda x: x[0]-x[1]) b = abs(L[0][0]-L[-1][0])+abs(L[0][1]-L[-1][1]) print(max(a, b))
p02556
s278226865
Accepted
n=int(input()) xy=[[int(_) for _ in input().split()]for i in range(n)] print(max(max([a[0]+a[1] for a in xy])-min([a[0]+a[1] for a in xy]),max([a[0]-a[1] for a in xy])-min([a[0]-a[1] for a in xy]))) # print(max([a[0]-a[1] for a in xy])-min([a[0]-a[1] for a in xy]))
p02556
s541164690
Accepted
N = int(input()) xys = [tuple(map(int, input().split())) for _ in range(N)] xpys = [x + y for x, y in xys] dist1 = max(xpys) - min(xpys) xmys = [x - y for x, y in xys] dist2 = max(xmys) - min(xmys) print(max(dist1, dist2))
p02556
s751335575
Accepted
n=int(input()) D=0 d=10**10 f=10**10 F=-10**10 for i in range(n): x,y=[int(x) for x in input().split()] l=x+y d=min(d,l) D=max(D,l) if y-x<f: m=[x,y] f=y-x if y-x>F: M=[x,y] F=y-x e=abs(m[0]-M[0])+abs(m[1]-M[1]) ans=max(D-d,e) print(ans)
p02556
s137751897
Accepted
N = int(input()) d = [[], []] for i in range(N): x, y = map(int, input().split()) d[0].append(x-y) d[1].append(x+y) ans = 0 for i in range(2): ans = max(ans, max(d[i])-min(d[i])) print(ans)
p02556
s584156029
Accepted
def resolve(): N = int(input()) _xmin, _xmax = float("inf"), -float("inf") _ymin, _ymax = float("inf"), -float("inf") for i in range(N): x, y = list(map(int, input().split())) _x, _y = x - y, x + y _xmin = min(_x, _xmin) _xmax = max(_x, _xmax) _ymin = min(_y, _ymin) _ymax = max(_y, _ymax) print(max(_xmax-_xmin, _ymax-_ymin)) if '__main__' == __name__: resolve()
p02556
s999059296
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) print(max(max(plus)-min(plus),max(minus)-min(minus)))
p02556
s178806002
Accepted
import sys sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): N = int(input()) XY = [[int(x) for x in input().split()] for _ in range(N)] arr1 = [] arr2 = [] for x, y in XY: arr1.append(x - y) arr2.append(x + y) print(max(abs(max(arr1) - min(arr1)), abs(max(arr2) - min(arr2)))) if __name__ == '__main__': main()
p02556
s537393372
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) dP=abs(max(P)-min(P)) dM=abs(max(M)-min(M)) print(max(dP,dM))
p02556
s274798137
Accepted
N = int(input()) l = [] for i in range(N): l.append([int(x) for x in input().split()]) xlim = [] ylim = [] def cha(a): return [a[0]-a[1],a[0]+a[1]] for i in range(N): ylim.append(cha(l[i])[1]) xlim.append(cha(l[i])[0]) xlim.sort() ylim.sort() print(max(xlim[-1]-xlim[0],ylim[-1]-ylim[0]))
p02556
s705270760
Accepted
import sys stdin = sys.stdin def ns(): return stdin.readline().rstrip() def ni(): return int(stdin.readline().rstrip()) def nm(): return map(int, stdin.readline().split()) def nl(): return list(map(int, stdin.readline().split())) def main(): n = ni() xy = list(nl() for _ in range(n)) xpy = [x + y for x, y in xy] xmy = [x - y for x, y in xy] print(max(max(xpy) - min(xpy), max(xmy) - min(xmy))) if __name__ == '__main__': main()
p02556
s708942406
Accepted
N = int(input()) xy = [list(map(int, input().split())) for _ in range(N)] z = [x + y for x, y in xy] w = [x - y for x, y in xy] z.sort() w.sort() ans = max(z[-1] - z[0], w[-1] - w[0]) print(ans)
p02556
s477646877
Accepted
n=int(input()) l=[list(map(int,input().split())) for i in range(n)] a=[] b=[] for i in range(n): a.append(l[i][0]+l[i][1]) b.append(l[i][0]-l[i][1]) print(max(max(a)-min(a),max(b)-min(b)))
p02556
s555337763
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 = max(A) b = min(A) c = max(B) d = min(B) ans = max(a-b,c-d) print(ans)
p02556
s025052083
Accepted
N = int(input()) P = [] M = [] A = [] def dist(p1, p2): return abs(p1[0]-p2[0]) + abs(p1[1]-p2[1]) for i in range(N): x, y = map(int, input().split()) P.append(x+y) M.append(x-y) A.append((x, y)) ans1 = dist(A[P.index(max(P))], A[P.index(min(P))]) ans2 = dist(A[M.index(max(M))], A[M.index(min(M))]) print(max(ans1, ans2))
p02556
s027937387
Accepted
def main(): f_0 = [] f_1 = [] n = int(input()) for i in range(n): x, y = map(int, input().split()) f_0.append(x-y) f_1.append(x+y) print(max(max(f_0)-min(f_0),max(f_1)-min(f_1))) if __name__ == "__main__": main()
p02556
s517830291
Accepted
n=int(input()) xy=[list(map(int,input().split())) for i in range(n)] ans=[] cand=[xy[i][0]+xy[i][1] for i in range(n)] #print(cand) ans.append(max(cand)-min(cand)) cand=[-xy[i][0]+xy[i][1]for i in range(n)] ans.append(max(cand)-min(cand)) cand=[-xy[i][0]-xy[i][1] for i in range(n)] ans.append(max(cand)-min(cand)) cand=[xy[i][0]-xy[i][1] for i in range(n)] ans.append(max(cand)-min(cand)) print(max(ans))
p02556
s956873045
Accepted
n = int(input()) x = [] y = [] z = [] for i in range(n): a,b = map(int, input().split()) x.append(a+b) y.append(a-b) z.append(b-a) print(max(max(x) - min(x),max(y) - min(y),max(z) - min(z)))
p02556
s524722611
Accepted
N = int(input()) que= [[]for i in range(2)] for i in range(N): x,y = map(int,input().split()) que[0].append(x-y) que[1].append(x+y) que[0].sort() que[1].sort() ans = max(que[0][-1]-que[0][0],que[1][-1]-que[1][0]) print(ans)
p02556
s592568511
Accepted
#!/usr/bin/env python3 (n,), *d = [[*map(int, o.split())] for o in open(0)] M = [[x - y for x, y in d], [x + y for x, y in d]] print(max(max(M[d]) - min(M[d]) for d in [0, 1]))
p02556
s948890240
Accepted
def main(): N = int(input()) p_list = [list(map(int, input().split())) for i in range(N)] z_list = [] w_list = [] for i in range(N): x = p_list[i][0] y = p_list[i][1] z_list.append(x + y) w_list.append(x - y) ans = max(max(z_list) - min(z_list), max(w_list) - min(w_list)) print(ans) return if __name__ == '__main__': main()
p02556
s709963035
Accepted
n = int(input()) p = [list(map(int, input().split())) for _ in range(n)] for i, v in enumerate(p): x, y = v p[i] = x-y, x+y xm, ym = -10**9, -10**9 xw, yw = 10**9, 10**9 for x, y in p: xm = max(xm, x) xw = min(xw, x) ym = max(ym, y) yw = min(yw, y) # print(p) ans = max(abs(xm - xw), abs(ym - yw)) print(ans)
p02556
s463577602
Accepted
def manhattan(n, x, y): x2 = [0] * n y2 = [0] * n for i in range(n): x2[i] = x[i] - y[i] y2[i] = x[i] + y[i] print(max(max(x2) - min(x2), max(y2) - min(y2))) n = int(input()) x = [0] * n y = [0] * n for i in range(n): x[i] , y[i] = map(int, input().split()) manhattan(n, x, y)
p02556
s189922963
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 = a[-1]-a[0] c = b[-1]-b[0] print (max(ans,c))
p02556
s938132391
Accepted
N = int(input()) x, y = map(int, input().split()) mz = Mz = x + y mw = Mw = x - y for i in range(N-1): x, y = map(int, input().split()) z = x + y w = x - y mz = min(mz, z) Mz = max(Mz, z) mw = min(mw, w) Mw = max(Mw, w) print(max(Mz-mz, Mw - mw))
p02556
s135347332
Accepted
n = int(input()) A = [] B = [] for i in range(n): a, b = map(int, input().split()) z = a + b w = a - b A.append(z) B.append(w) P = abs(max(A) - min(A)) Q = abs(max(B) - min(B)) print(max(P, Q))
p02556
s539625141
Accepted
import numpy as np f = open(0) N = int(f.readline()) xy = np.fromstring(f.read(), dtype=np.int64, sep=' ').reshape((-1, 2)).T.copy() x = xy[0] y = xy[1] c1 = x + y c2 = x - y ans = max(c1.max() - c1.min(), c2.max() - c2.min()) print(ans)
p02556
s791379307
Accepted
def main(): n = int(input()) xy = [list(map(int, input().split())) for _ in [0]*n] z1 = [x+y for x, y in xy] z2 = [x-y for x, y in xy] z3 = [-x+y for x, y in xy] z4 = [-x-y for x, y in xy] print(max([max(z1)-min(z1), max(z2)-min(z2), max(z3)-min(z3), max(z4)-min(z4)])) main()
p02556
s209077796
Accepted
n=int(input()) p=[] q=[] for _ in range(n): x,y=map(int,input().split()) p.append(x+y) q.append(x-y) print(max(max(p)-min(p),max(q)-min(q)))
p02556
s820851792
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.sort() b.sort() ans = max(a[-1]-a[0], b[-1]-b[0]) print(ans)
p02556
s901426584
Accepted
def main(): point_count = int(input()) inf = 10 ** 10 max_sum, min_sum, max_diff, min_diff = - inf, inf, - inf, inf for _ in range(point_count): x, y = [int(x) for x in input().split()] max_sum = max(x + y, max_sum) min_sum = min(x + y, min_sum) max_diff = max(x - y, max_diff) min_diff = min(x - y, min_diff) return max(max_sum - min_sum, max_diff - min_diff) if __name__ == '__main__': print(main())
p02556
s709775635
Accepted
N = int(input()) plus_max = -10**10 plus_min = 10**10 minus_max = -10**10 minus_min = 10**10 for i 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
s529306768
Accepted
n = int(input()) l, l2 = [], [] for i in range(n): x, y = map(int, input().split()) l.append(x + y) l2.append(x - y) print(max(max(l) - min(l), max(l2) - min(l2)))
p02556
s358834224
Accepted
import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) N = int(input()) XY = [list(mapint()) for _ in range(N)] XY.sort(key=lambda x:x[0]+x[1]) ans_1 = abs(XY[0][0]-XY[-1][0])+abs(XY[0][1]-XY[-1][1]) XY.sort(key=lambda x:x[0]-x[1]) ans_2 = abs(XY[0][0]-XY[-1][0])+abs(XY[0][1]-XY[-1][1]) print(max(ans_1, ans_2))
p02556
s026039384
Accepted
n = int(input()) wa = [0]*n sa = [0]*n for i in range(n): x,y = map(int,input().split()) wa[i] = x+y sa[i] = x-y wanosa = max(wa) - min(wa) sanosa = max(sa) - min(sa) ans = max(wanosa,sanosa) print(ans)
p02556
s492059520
Accepted
n = int(input()) maxda = -10**18 minda = 10**18 maxdb = -10**18 mindb = 10**18 for i in range(n): x,y = map(int,input().split()) maxda = max(maxda, x-y) minda = min(minda, x-y) maxdb = max(maxdb, x+y) mindb = min(mindb, y+x) print(max(maxda-minda, maxdb-mindb))
p02556
s237002629
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 alpha=max(Z)-min(Z) beta=max(W)-min(W) print(max(alpha,beta))
p02556
s823785865
Accepted
(N,) = [int(x) for x in input().split()] XY = [[int(x) for x in input().split()] for i in range(N)] best = 0 mn = min(XY, key=lambda pt: pt[0] + pt[1]) mx = max(XY, key=lambda pt: pt[0] + pt[1]) best = max(best, abs(mn[0] - mx[0]) + abs(mn[1] - mx[1])) mn = min(XY, key=lambda pt: pt[0] - pt[1]) mx = max(XY, key=lambda pt: pt[0] - pt[1]) best = max(best, abs(mn[0] - mx[0]) + abs(mn[1] - mx[1])) print(best)
p02556
s821045281
Accepted
n = int(input()) X = [] Y = [] for i in range(n): x,y = map(int,input().split()) X.append(x+y) Y.append(x-y) print(max(max(X)-min(X),max(Y)-min(Y)))