problem_id
stringclasses
100 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
6
806
p02556
s397937346
Accepted
n=int(input()) xy=[list(map(int, input().split())) for _ in range(n)] a1=0 a2=xy[0][0]+xy[0][1] b1=xy[0][0]-xy[0][1] b2=xy[0][0]-xy[0][1] for i in range(n): res1=xy[i][0]+xy[i][1] res2=xy[i][0]-xy[i][1] a1=max(a1,res1) a2=min(a2,res1) b1=max(b1,res2) b2=min(b2,res2) ans=max(a1-a2,b1-b2) print(ans)
p02556
s064628050
Accepted
n=int(input()) fxy=[[] for _ in range(n)] for i in range(n): x,y=map(int, input().split()) fxy[i].append(x-y) fxy[i].append(x+y) fxy.sort() ans=fxy[-1][0]-fxy[0][0] fxy.sort(key=lambda x: x[1]) ans=max(ans,fxy[-1][1]-fxy[0][1]) print(ans)
p02556
s919905110
Accepted
n, *XY = map(int, open(0).read().split()) X, Y = XY[::2], XY[1::2] A = [x+y for x, y in zip(X, Y)] B = [x-y for x, y in zip(X, Y)] print(max(max(A) - min(A), max(B) - min(B)))
p02556
s291850179
Accepted
N = int(input()) X,Y = [],[] def func(p): return p[0]-p[1], p[0]+p[1] for _ in range(N): x,y = func(list(map(int,input().split()))) X.append(x) Y.append(y) ans = 0 ans = max(max(X)-min(X),max(Y)-min(Y)) print(ans)
p02556
s124735739
Accepted
n=int(input()) xy_1 = [0]*n xy_2 = [0]*n for i in range(n): x,y = map(int,input().split()) xy_1[i] = x + y xy_2[i] = x - y print(max(max(xy_1) - min(xy_1), max(xy_2)-min(xy_2)))
p02556
s768126180
Accepted
def main(): point_count = int(input()) sums = [] diffs = [] for _ in range(point_count): x, y = [int(x) for x in input().split()] sums.append(x + y) diffs.append(x - y) pat_sum = abs(max(sums) - min(sums)) pat_diff = abs(max(diffs) - min(diffs)) return max(pat_sum, pat_diff) if __name__ == '__main__': print(main())
p02556
s567728268
Accepted
n = int(input()) amx = -float("inf") amn = float("inf") bmx = -float("inf") bmn = float("inf") ans = -float("inf") for i in range(n): a,b = map(int,input().split()) amx = max(amx,a+b) amn = min(amn,a+b) bmx = max(bmx,a-b) bmn = min(bmn,a-b) print(max(amx-amn,bmx-bmn))
p02556
s774985576
Accepted
n = int(input()) z,w = [],[] for _ in range(n): x,y = map(int,input().split()) z.append(x+y) w.append(x-y) print(max(max(z)-min(z),max(w)-min(w)))
p02556
s367482450
Accepted
n=int(input()) x=[] y=[] for i in range(n): s,t=map(int,input().split()) x.append(s+t) y.append(s-t) print(max(max(x)-min(x),max(y)-min(y)))
p02556
s842805300
Accepted
n = int(input()) lst_plus = [] lst_minus = [] for i in range(n): x,y = map(int,input().split()) lst_plus.append(x+y) lst_minus.append(y-x) lst_plus.sort() lst_minus.sort() A = lst_plus[-1] - lst_plus[0] B = lst_minus[-1] - lst_minus[0] print(max([A,B]))
p02556
s557064093
Accepted
N = int(input()) xys =[list(map(int, input().split())) for _ in range(N)] ws = [x+y for x,y in xys] zs = [x-y for x,y in xys] print(max([max(ws)-min(ws), max(zs)-min(zs)]))
p02556
s392761529
Accepted
N = int(input()) z = [] zz = [] for _ in range(N): x, y = map(int, input().split()) zz.append(x-y) z.append(x+y) z.sort() zz.sort() ans = z[-1]-z[0] ans = max(ans, zz[-1]-zz[0]) print(ans)
p02556
s345975035
Accepted
def solve(): N = int(input()) xy_l = [None] * N invxy_l = [None] * N for _ in range(N): _x, _y = map(int, input().split()) xy_l[_] = _x + _y - 2 invxy_l[_] = _y - 1 - (_x - 1) ans_a = max(xy_l) - min(xy_l) ans_b = max(invxy_l) - min(invxy_l) if ans_a > ans_b: print(ans_a) else: print(ans_b) solve()
p02556
s208337851
Accepted
X = [] Y = [] N = int(input()) for i in range(N): x, y = map(int, input().split()) X.append(x + y) Y.append(x - y) ans = max(max(X)-min(X), max(Y)-min(Y)) print(ans)
p02556
s037477687
Accepted
n = int(input()) xy = [list(map(int, input().split())) for _i in range(n)] x = [i+j for i, j in xy] y = [i-j for i, j in xy] x.sort() y.sort() print(max(abs(x[0]-x[-1]), abs(y[0]-y[-1])))
p02556
s583845169
Accepted
def main(): n = int(input()) a_li , b_li = [] , [] for _ in range(n): x , y = map(int,input().split()) a_li.append(x + y) b_li.append(x - y) print(max(max(a_li) - min(a_li), max(b_li) - min(b_li))) if __name__ == "__main__": main()
p02556
s660885626
Accepted
n = int(input()) XY = [tuple(map(int, input().split())) for i in range(n)] A = [x + y for x, y in XY] B = [x - y for x, y in XY] print(max(max(A) - min(A), max(B) - min(B)))
p02556
s021028466
Accepted
n = int(input()) p = [] for i in range(n): x,y = map(int,input().split()) p.append([x,y]) q = [] r = [] for i in range(n): q.append(p[i][0]+p[i][1]) r.append(p[i][0]-p[i][1]) q.sort() r.sort() ans = max(abs(q[-1]-q[0]),abs(r[-1]-r[0])) print(ans)
p02556
s914320834
Accepted
import sys input = sys.stdin.readline n = int(input()) xy = tuple(map(int, input().split())) pM = sum(xy) pm = sum(xy) mM = xy[0] - xy[1] mm = xy[0] - xy[1] for _ in range(n - 1): xy = tuple(map(int, input().split())) s = sum(xy) d = xy[0] - xy[1] if s > pM: pM = s elif s < pm: pm = s if d > mM: mM = d elif d < mm: mm = d print(max(abs(pM - pm), abs(mM - mm)))
p02556
s763994730
Accepted
N = int(input()) xy = [list(map(int, input().split())) for _ in range(N)] ans = 0 ur = sorted(xy, key=lambda x: x[0]+x[1])[-1] ul = sorted(xy, key=lambda x: x[1]-x[0])[-1] dr = sorted(xy, key=lambda x: x[0]-x[1])[-1] dl = sorted(xy, key=lambda x: -x[0]-x[1])[-1] l = [ur, ul, dr, dl] for i in l: for j in l: ans = max(ans, abs(i[0]-j[0])+abs(i[1]-j[1])) print(ans)
p02556
s016964288
Accepted
N = int(input()) x, y = map(int, input().split()) d = [x - y, x - y, x + y, x + y] for i in range(1,N): x, y = map(int, input().split()) d[0] = max(d[0], x-y) d[1] = min(d[1], x-y) d[2] = max(d[2], x+y) d[3] = min(d[3], x+y) print(max(d[0]-d[1], d[2]-d[3]))
p02556
s383419447
Accepted
def main(): n = int(input()) xym, xyM, x_ym, x_yM = 10**9, -10**9, 10**9, -10**9 for _ in range(n): x, y = map(int, input().split()) xy, x_y = x+y, x-y xym, xyM, x_ym, x_yM = min(xym, xy), max(xyM, xy), min(x_ym, x_y), max(x_yM, x_y) print(max(xyM-xym, x_yM-x_ym)) if __name__ == "__main__": main()
p02556
s925881811
Accepted
import sys INF = 1 << 60 MOD = 10**9 + 7 # 998244353 sys.setrecursionlimit(2147483647) input = lambda:sys.stdin.readline().rstrip() def resolve(): a0 = a1 = a2 = a3 = INF ans = 0 for _ in range(int(input())): x, y = map(int, input().split()) ans = max(ans, x + y - a0, x - y - a1, -x + y - a2, -x - y - a3) a0 = min(a0, x + y) a1 = min(a1, x - y) a2 = min(a2, -x + y) a3 = min(a3, -x - y) print(ans) resolve()
p02556
s213230552
Accepted
N = int(input()) X = [] Y = [] for _ in range(N): x, y = list(map(int, input().split())) X.append(x) Y.append(y) points = [] for x, y in zip(X, Y): points.append(( x + y, x - y )) print(max(max(dim) - min(dim) for dim in zip(*points)))
p02556
s627341954
Accepted
n=int(input()) r=[] for _ in range(n): a,b=map(int,input().split()) r.append([a+b,a-b]) r=list(zip(*r)) print(max(max(r[0])-min(r[0]),max(r[1])-min(r[1])))
p02556
s025355504
Accepted
N = int(input()) points = [] for _ in range(N): points.append([int(s) for s in input().split()]) def dist(x, y): return abs(x[0] - y[0]) + abs(x[1] - y[1]) points.sort(key=lambda x: x[0] + x[1]) d1 = dist(points[0], points[-1]) # print(points) points.sort(key=lambda x: x[0] - x[1]) d2 = dist(points[0], points[-1]) # print(points) print(max(d1, d2))
p02556
s441383785
Accepted
N = int(input()) ans = 0 x, y = map(int, input().split()) Max_A = x+y Min_A = x+y Max_B = -x+y Min_B = -x+y for i in range(1,N): x, y = map(int, input().split()) C = x + y D = -x + y temp = max( abs(Max_A-C), abs(Min_A-C), abs(Max_B-D), abs(Min_B-D) ) ans = max(ans, temp) #print(C, D, ans) Max_A = max(Max_A, C) Max_B = max(Max_B, D) Min_A = min(Min_A, C) Min_B = min(Min_B, D) print(ans)
p02556
s984167710
Accepted
n, *XY = map(int, open(0).read().split()) X, Y = XY[::2], XY[1::2] A = [x+y for x, y in zip(X, Y)] B = [x-y for x, y in zip(X, Y)] A.sort() B.sort() print(max(A[-1] - A[0], B[-1] - B[0]))
p02556
s467403652
Accepted
N = int(input()) lst = [list(map(int, input().split())) for _ in range(N)] max_1 = -float('inf') min_1 = float('inf') max_2 = -float('inf') min_2 = float('inf') for a, b in lst: max_1 = max(max_1, a - b) min_1 = min(min_1, a - b) max_2 = max(max_2, a + b) min_2 = min(min_2, a + b) ans = max(max_1 - min_1, max_2 - min_2) print(ans)
p02556
s897631739
Accepted
n = int(input()) X = [] Y = [] for i in range(n): x,y = map(int, input().split()) x,y = x-y,x+y X.append(x) Y.append(y) a = max(Y) - min(Y) b = max(X) - min(X) print(max(a,b))
p02556
s781881482
Accepted
# import sys # input = sys.stdin.readline def mp(): return map(int, input().split()) def lmp(): return list(map(int, input().split())) n = int(input()) point = [] p = [] m = [] for i in range(n): a,b = mp() point.append((a,b)) p.append(a+b) m.append(a-b) print(max(max(p)-min(p), -min(m)+max(m), max(m)-min(m), -min(p)+max(p)))
p02556
s820065170
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
s788239154
Accepted
n = int(input()) ans = 0 ma1, mi1 = -10000000000, 10000000000 ma2, mi2 = -10000000000, 10000000000 for i in range(n): x, y = map(int, input().split()) ma1 = max(ma1, x - y) mi1 = min(mi1, x - y) ma2 = max(ma2, x + y) mi2 = min(mi2, x + y) ans = max(ans, ma1 - mi1, ma2 - mi2) print(ans)
p02556
s113704181
Accepted
from sys import stdin readline = stdin.readline def i_input(): return int(readline().rstrip()) def i_map(): return map(int, readline().rstrip().split()) def i_list(): return list(i_map()) def main(): N = i_input() Z = [] W = [] for i in range(1, N + 1): x, y = i_map() Z.append(x + y) W.append(x - y) Z.sort() W.sort() ans = max([Z[-1] - Z[0], W[-1] - W[0]]) print(ans) if __name__ == "__main__": main()
p02556
s328408531
Accepted
import sys input = sys.stdin.readline n = int(input()) C = [list(map(int,input().split())) for i in range(n)] a = 2*10**9+5 b = -2*10**9+5 c = 2*10**9+5 d = -2*10**9+5 for i in range(n): a = min(a, C[i][0]+C[i][1]) b = max(b, C[i][0]+C[i][1]) c = min(c, C[i][0]-C[i][1]) d = max(d, C[i][0]-C[i][1]) print(max(b-a,d-c))
p02556
s687322599
Accepted
import sys def f(x, y): return x - y, x + y def main(): input = sys.stdin.buffer.readline n = int(input()) x = [0] * n y = [0] * n for i in range(n): x[i], y[i] = map(int, input().split()) f0 = [0] * n f1 = [0] * n for i in range(n): f0[i], f1[i] = f(x[i], y[i]) print(max(max(f0) - min(f0), max(f1) - min(f1))) if __name__ == "__main__": main()
p02556
s329056471
Accepted
N = int(input()) a = [0 for i in range(N)] b = [0 for i in range(N)] for i in range(N): x, y = list(map(int, input().split())) a[i] = x + y b[i] = x - y a = sorted(a) b = sorted(b) print(max(a[N-1]-a[0], b[N-1]-b[0]))
p02556
s230988670
Accepted
#E N=int(input()) x=[0 for i in range(N)] y=[0 for i in range(N)] Cx=[0 for i in range(N)] Cy=[0 for i in range(N)] for i in range(N): x[i],y[i]=map(int,input().split()) Cx[i]=x[i]+y[i] Cy[i]=x[i]-y[i] ans=max(max(Cx)-min(Cx),max(Cy)-min(Cy)) print(ans)
p02556
s709328573
Accepted
n=int(input()) a_list=[list(map(int,input().split())) for _ in range(n)] f_list_0 = [] f_list_1 = [] for i in range(n): f_list_0.append(a_list[i][0]+a_list[i][1]) f_list_1.append(a_list[i][0]-a_list[i][1]) ans_0 = max(f_list_0) - min(f_list_0) ans_1 = max(f_list_1) - min(f_list_1) print(max((ans_0, ans_1)))
p02556
s360504889
Accepted
N=int(input()) xy=[] xmax,xmin,ymax,ymin = -10**10,10**10,-10**10,10**10 for i in range(N): x,y=map(int,input().split()) xmax = max(xmax,x+y) ymax = max(ymax,x-y) xmin = min(xmin,x+y) ymin = min(ymin,x-y) print(max(xmax-xmin,ymax-ymin))
p02556
s888567715
Accepted
import sys readline = sys.stdin.readline N = int(readline()) X,Y = [None] * N, [None] * N for i in range(N): x,y = map(int,readline().split()) X[i],Y[i] = x + y,x - y print(max(abs(max(X) - min(X)),abs(max(Y) - min(Y))))
p02556
s902116132
Accepted
import sys sys.setrecursionlimit(10 ** 7) rl = sys.stdin.readline def solve(): N = int(rl()) xy = [list(map(int, rl().split())) for _ in range(N)] a = [xi + yi for xi, yi in xy] a.sort() b = [xi - yi for xi, yi in xy] b.sort() ans = max(a[-1] - a[0], b[-1] - b[0]) print(ans) if __name__ == '__main__': solve()
p02556
s469290257
Accepted
N = int(input()) add = [] diff = [] for _ in range(N): x, y = list(map(int, input().split())) add.append(x+y) diff.append(x-y) add.sort() diff.sort() print(max(add[-1]-add[0], diff[-1]-diff[0]))
p02556
s843015564
Accepted
n = int(input()) xy = [[int(i) for i in input().split()] for j in range(n)] mi = 10**10 ma = 0 for i in range(n): tmp = xy[i][0] + xy[i][1] if tmp > ma: ma = tmp #print(tmp,mi) if tmp < mi: mi = tmp ans = ma-mi mi = 10**10 ma = -10**10 for i in range(n): tmp = xy[i][0] - xy[i][1] if tmp > ma: ma = tmp #print(tmp,mi) if tmp < mi: mi = tmp print(max(ans,ma-mi))
p02556
s003933606
Accepted
n=int(input()) z=[] w=[] for i in range(n): x,y=map(int,input().split()) z.append(x+y) w.append(x-y) print(max(max(z)-min(z),max(w)-min(w)))
p02556
s195429259
Accepted
N = int(input()) A = 0 Xmin = Ymin = 3e9 + 5 Xmax = Ymax = -3e9 - 5 for _ in range(N): x, y = map(int, input().split()) X = x + y Y = x - y Xmin = min(Xmin, X) Xmax = max(Xmax, X) Ymin = min(Ymin, Y) Ymax = max(Ymax, Y) if Xmin == 3e9 + 5: Xmin = Xmax if Ymin == 3e9 + 5: Ymin = Ymax if Xmax == -3e9 - 5: Xmax = Xmin if Ymax == -3e9 -5: Ymax = Ymin Z = max(Xmax - Xmin, Ymax - Ymin) print(Z)
p02556
s543529027
Accepted
N = int(input()) G = [] for i in range(N): x,y = map(int,input().split()) G.append([x,y]) a = -10**10 b = 10**10 c = -10**10 d = 10**10 for i in range(N): x = G[i][0] y = G[i][1] t = x+y u = x-y a = max(a,t) b = min(b,t) c = max(c,u) d = min(d,u) #print(a,b,c,d) ans = max(a-b,c-d) print(ans)
p02556
s899087610
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
s579188212
Accepted
N = int(input()) XY = [list(map(int, input().split())) for _ in range(N)] U = [x+y for x, y in XY] V = [x-y for x, y in XY] min_u = min(U) max_u = max(U) min_v = min(V) max_v = max(V) print(max( max_u - min_u, max_v - min_v ))
p02556
s946230142
Accepted
#!/usr/bin/env pypy3 from sys import stdin, stdout def input(): return stdin.readline().strip() sum = [] dif = [] N = int(input()) for _ in range(N): x, y = input().split() x = int(x) y = int(y) sum += [x+y] dif += [x-y] ans1 = max(sum) - min(sum) ans2 = max(dif) - min(dif) print(max(ans1, ans2))
p02556
s851908232
Accepted
import sys def f(x,y): return x-y,x+y def main(): input = sys.stdin.buffer.readline n = int(input()) x = [0]*n y = [0]*n for i in range(n): x[i],y[i] = map(int,input().split()) f0 = [0]*n f1 = [0]*n for i in range(n): f0[i],f1[i] = f(x[i],y[i]) print(max(max(f0)-min(f0),max(f1)-min(f1))) if __name__ == "__main__": main()
p02556
s179573313
Accepted
n = int(input()) x = [0] * n y = [0] * n for i in range(n): x[i], y[i] = map(int, input().split()) a = [] b = [] for i in range(n): a.append(x[i]-y[i]) b.append(x[i]+y[i]) c = max(a) - min(a) d = max(b) - min(b) print(max(c,d))
p02556
s767858454
Accepted
n = int(input()) a, b = [], [] for _ 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)
p02556
s087693179
Accepted
n = int(input()) xy = [map(int, input().split()) for _ in range(n)] x, y = [list(i) for i in zip(*xy)] for i in range(n): buf = x[i] x[i] = x[i]+y[i] y[i] = buf-y[i] dx = max(x) - min(x) dy = max(y) - min(y) print(max(dx,dy))
p02556
s306080518
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_dist = max(d1) - min(d1) d2_dist = max(d2) - min(d2) print(max([d1_dist, d2_dist])) if __name__ == '__main__': main()
p02556
s133639319
Accepted
import sys input = lambda: sys.stdin.readline().rstrip() N = int(input()) X = [] for _ in range(N): x, y = map(int, input().split()) X.append((x * 2, y * 2)) X = sorted(X, key = lambda x: -x[1]) x0, y0 = X[0] ans = 0 for x, y in X[1:]: ans = max(ans, y0 - y + abs(x - x0)) a = (abs(x - x0) - (y0 - y)) // 2 if a < 0: continue x0 += a if x0 < x else -a y0 += a print(ans // 2)
p02556
s156746327
Accepted
n=int(input()) z_max,z_min=-10**10,10**10 w_max,w_min=-10**10,10**10 for i in range(n): a,b=map(int,input().split()) z=a+b w=a-b z_max=max(z_max,z) z_min=min(z_min,z) w_max=max(w_max,w) w_min=min(w_min,w) print(max(z_max-z_min,w_max-w_min))
p02556
s892554804
Accepted
N = int(input()) x = [0] * N y = [0] * N for i in range(N): a, b = map(int, input().split()) x[i]=a+b y[i]=a-b xmax=max(x) xmin=min(x) ymax=max(y) ymin=min(y) print(max(xmax-xmin,ymax-ymin))
p02556
s410672239
Accepted
import numpy as np N = int(input()) max_z = -np.Inf min_z = np.inf max_w = -np.Inf min_w = np.inf for _ in range(N): x, y = map(int, input().split()) z = x + y w = x - y max_z = max(max_z, z) min_z = min(min_z, z) max_w = max(max_w, w) min_w = min(min_w, w) print(max(max_z-min_z, max_w-min_w))
p02556
s576447654
Accepted
def func(x, y): res, n = 0, len(x) for p, q in [[1, 1], [1, -1], [-1, 1], [-1, -1]]: smallest = p * x[0] + q * y[0] + 0 for i in range(n): cur = p * x[i] + q * y[i] res = max(res, cur - smallest) smallest = min(smallest, cur) return res n = int(input()) x,y = [],[] for i in range(n): a,b = list(map(int,input().split())) x.append(a) y.append(b) print(func(x,y))
p02556
s346418800
Accepted
N = int(input()) Z = [] W = [] for i in range(N) : x,y = map(int,input().split()) Z.append(x+y) W.append(x-y) print(max((max(Z)-min(Z)),max(W)-min(W)))
p02556
s567919566
Accepted
n=int(input()) bignum=10**30 num1,num2,num3,num4=-bignum,bignum,-bignum,bignum for i in range(n): x,y=map(int, input().split()) num1=max(x+y,num1) num2=min(x+y,num2) num3=max(x-y,num3) num4=min(x-y,num4) print(max(num1-num2,num3-num4))
p02556
s141814685
Accepted
n = int(input()) x = [] y = [] for i in range(n): a, b = [int(i) for i in input().split()] x.append(a+b) y.append(a-b) x.sort() y.sort() print(max(abs(x[0]-x[n-1]),abs(y[0]-y[n-1])))
p02556
s347700705
Accepted
N = int(input()) x = [] y = [] for i in range(N): in1, in2 = list(map(int,input().split())) x.append(in1) y.append(in2) #f = [[0]*2 for i in range(N)] X=[] Y=[] for i in range(N): #f[i][0] = x[i]-x[i] #f[i][1] = x[i]+y[i] X.append(x[i]-y[i]) Y.append(x[i]+y[i]) dam1 = max(X) - min(X) dam2 = max(Y) - min(Y) print(max(dam1,dam2))
p02556
s173465498
Accepted
n=int(input()) zp=[] zl=[] for i in range(n): a,b=map(int,input().split()) zp.append(a+b) zl.append(a-b) ans=max((max(zp)-min(zp)),(max(zl)-min(zl))) print(ans)
p02556
s267449036
Accepted
# coding: utf-8 # Your code here! import sys readline = sys.stdin.readline read = sys.stdin.read n,*xy = map(int,read().split()) wa = [] sa = [] for x,y in zip(xy[::2],xy[1::2]): wa.append(x+y) sa.append(x-y) v = max(wa)-min(wa) w = max(sa)-min(sa) print(max(v,w))
p02556
s458194728
Accepted
#!/usr/bin/env python3 def main(): n = int(input()) xy = [list(map(int, input().split())) for i in range(n)] max_z, max_w, min_z, min_w = -10**20, -10**20, 10**20, 10**20 ans = 0 for p in xy: max_z, max_w = max(max_z, p[0] + p[1]), max(max_w, p[0] - p[1]) min_z, min_w = min(min_z, p[0] + p[1]), min(min_w, p[0] - p[1]) ans = max(max_z - min_z, max_w - min_w) print(ans) if __name__ == "__main__": main()
p02556
s033850576
Accepted
N = int(input()) X = [] Y = [] for i in range(N): x, y = map(int, input().split()) X.append(x) Y.append(y) ans = -float("inf") left = -float("inf") right = float("inf") for i in range(N): left = max(left, X[i]-Y[i]) right = min(right, X[i]-Y[i]) ans = max(ans, left - right) left = -float("inf") right = float("inf") for i in range(N): left = max(left, X[i]+Y[i]) right = min(right, X[i]+Y[i]) ans = max(ans, left - right) print(ans)
p02556
s475894227
Accepted
n = int(input()) xy = [list(map(int, input().split())) for _ in range(n)] xy1 = max(x + y for x, y in xy) xy2 = max(-x - y for x, y in xy) xy3 = max(-x + y for x, y in xy) xy4 = max(x - y for x, y in xy) print(max(xy1 + xy2, xy3 + xy4))
p02556
s997339190
Accepted
import sys from operator import itemgetter N = int(input()) V = set() for s in sys.stdin.readlines(): x, y = map(int, s.split()) V.add((x + y, x - y)) y1 = max(V, key=itemgetter(1))[1] y2 = min(V, key=itemgetter(1))[1] x1 = max(V, key=itemgetter(0))[0] x2 = min(V, key=itemgetter(0))[0] print(max(abs(x1 - x2), abs(y1 - y2)))
p02556
s414795331
Accepted
n = int(input()) xy_sum = [] xy_dif = [] for i in range(n) : x, y = map(int, input().split()) xy_sum.append(x + y) xy_dif.append(x - y) print(max(abs(max(xy_sum) - min(xy_sum)), abs(max(xy_dif) - min(xy_dif))))
p02556
s170699244
Accepted
N = int(input()) points_pp = [] points_pn = [] points_np = [] points_nn = [] for _ in range(N): x, y = map(int, input().split()) points_pp.append(x+y) points_nn.append(-x-y) points_pn.append(x-y) points_np.append(-x+y) ans_pp = max(points_pp) - min(points_pp) ans_pn = max(points_pn) - min(points_pn) ans_np = max(points_np) - min(points_np) ans_nn = max(points_nn) - min(points_nn) print(max(ans_pp, ans_pn, ans_np, ans_nn))
p02556
s081972936
Accepted
N=int(input()) axis1=[] axis2=[] for i in range(N): x,y = map(int,input().split()) axis1.append(x-y) axis2.append(x+y) ans1 = max(axis1)-min(axis1) ans2 = max(axis2)-min(axis2) print(max(ans1,ans2))
p02556
s142166940
Accepted
n = int(input()) i = [] for z in range(n): i.append([int(s) for s in input().split()]) ur = [ind[0]+ind[1] for ind in i] ul = [ind[0]-ind[1] for ind in i] print(max([max(ur)-min(ur), max(ul)-min(ul)]))
p02556
s983683647
Accepted
n = int(input()) zm = -2e10 zn = 30000000000 wm = -2e10 wn = 30000000000 while(n): x,y = map(int,input().split()) zm = max(zm,x+y) zn = min(zn,x+y) wm = max(wm,x-y) wn = min(wn,x-y) n-=1 print(max(zm-zn,wm-wn))
p02556
s826562672
Accepted
N=int(input()) xy = [] d0, d1 = [],[] for _ in range(N): x,y=map(int,input().split()) d0.append(x-y) d1.append(x+y) print(max(max(d0)-min(d0), max(d1)-min(d1)))
p02556
s497367487
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(X, Y) maxX = max(X) maxY = max(Y) minX = min(X) minY = min(Y) ans = max(maxX - minX, maxY - minY) print(ans)
p02556
s517118546
Accepted
n = int(input()) x = [] y = [] for _ in range(n): X,Y = map(int,input().split()) x.append(X) y.append(Y) res = 0 for p, q in [[1, 1], [1, -1], [-1, 1], [-1, -1]]: smallest = p * x[0] + q * y[0] + 0 for i in range(n): cur = p * x[i] + q * y[i] res = max(res, cur - smallest) smallest = min(smallest, cur) print(res)
p02556
s787341788
Accepted
N=int(input()) XY=[list(map(int,input().split())) for i in range(N)] a,b,c,d=-10**10,10**10,-10**10,10**10 l=[0]*4 for x,y in XY: if x+y>a: a=x+y;l[0]=(x,y) if x+y<b: b=x+y;l[1]=(x,y) if x-y>c: c=x-y;l[2]=(x,y) if x-y<d: d=x-y;l[3]=(x,y) from itertools import combinations print(max([abs(p[0]-q[0])+abs(p[1]-q[1]) for p,q in combinations(l,2)]))
p02556
s180753733
Accepted
n=int(input()) a=[] b=[] c=[] d=[] for i in range(n): k,l=map(int,input().split()) a.append((k-l,i)) b.append((k+l,i)) c.append((-k-l,i)) d.append((-k+l,i)) a.sort(reverse=True) b.sort(reverse=True) c.sort(reverse=True) d.sort(reverse=True) print(max(a[0][0]+d[0][0],b[0][0]+c[0][0]))
p02556
s038198706
Accepted
from collections import Counter,defaultdict,deque from heapq import heappop,heappush from bisect import bisect_left,bisect_right import sys,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) n = inp() a = [] b = [] for _ in range(n): x,y = inpl() a.append(x+y) b.append(x-y) print(max(max(a)-min(a), max(b)-min(b)))
p02556
s558615173
Accepted
n = int(input()) xy_array = [list(map(int, input().split())) for _ in range(n)] th = pow(10, 9) right_up_max = -th left_down_min = th left_up_max = -th right_down_min = th for x, y in xy_array: right_up_max = max(x + y, right_up_max) left_down_min = min(x + y, left_down_min) left_up_max = max(x - y, left_up_max) right_down_min = min(x - y, right_down_min) ans = max(right_up_max - left_down_min, left_up_max - right_down_min) print(ans)
p02556
s342602562
Accepted
n = int(input()) xpy = [] xmy = [] for i in range(n): x,y = map(int,input().split()) xpy.append(x+y) xmy.append(x-y) xpy.sort() xmy.sort() print(max(abs(xpy[0]-xpy[-1]),abs(xmy[0]-xmy[-1])))
p02556
s446738236
Accepted
N=int(input()) a,b,c,d=0,1e10,-1e10,1e10 for i in range(N): A,B=input().split() A=int(A) B=int(B) a=max(a,A+B) b=min(b,A+B) c=max(c,A-B) d=min(d,A-B) print(max(abs(a-b),abs(c-d)))
p02556
s626979447
Accepted
n = int(input()) xy = [list(map(int, input().split())) for i in range(n)] a = [x+y for x,y in xy] b = [x-y for x,y in xy] ans = max(max(a)-min(a), max(b)-min(b)) print(ans)
p02556
s302392991
Accepted
N = int(input()) XY_set = set(tuple(map(int, input().split())) for _ in range(N)) N = len(XY_set) XY45 = [(x + y, x - y) for x, y in XY_set] ans = max(max(x for x, _ in XY45) - min(x for x, _ in XY45), max(y for _, y in XY45) - min(y for _, y in XY45)) print(ans)
p02556
s791327421
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
s639477081
Accepted
N = int(input()) X = [] Y = [] ans = 0 for i in range(N): x, y = map(int, input().split()) X.append(x+y) Y.append(x-y) m = [max(X), max(Y)] s = [min(X), min(Y)] for i in range(2): ans = max(ans, m[i]-s[i]) print(ans)
p02556
s232019477
Accepted
n = int(input()) fx = [[0 for i in range(4)] for j in range(n)] for i in range(n): x, y = map(int, input().split()) fx[i][0] = x + y fx[i][1] = x - y fx[i][2] = - x + y fx[i][3] = - x - y ans = 0 for j in range(4): saidai = -(10 ** 10) saisho = 10 ** 10 for i in range(n): if saidai < fx[i][j]: saidai = fx[i][j] if saisho > fx[i][j]: saisho = fx[i][j] ans = max(ans, saidai - saisho) print(ans)
p02556
s778948459
Accepted
N = int(input()) M1 = -10 ** 10 M2 = - 10 ** 10 m1 = 10 ** 10 m2 = 10 ** 10 for i in range(N): x, y = map(int, input().split()) M1 = max(x + y, M1) m1 = min(x + y, m1) M2 = max(x - y, M2) m2 = min(x - y, m2) print(max(M1 - m1, M2 - m2))
p02556
s660987499
Accepted
N = int(input()) x, y = [0]*N, [0]*N for i in range(N): a, b = map(int, input().split()) x[i] = a y[i] = b maxZ, minZ = x[0] + y[0], x[0] + y[0] maxW, minW = x[0] - y[0], x[0] - y[0] for i in range(N): z = x[i] + y[i] w = x[i] - y[i] maxZ = max(maxZ, z) minZ = min(minZ, z) maxW = max(maxW, w) minW = min(minW, w) ans = max(maxZ-minZ, maxW-minW) print(ans)
p02556
s225932343
Accepted
N = int(input()) p = [] for _ in range(N): x, y = map(int, input().split()) p.append((x, y)) p = sorted(p, key=lambda i: i[0] + i[1]) x1, y1 = p[0] x2, y2 = p[-1] res = abs((x1 + y1) - (x2 + y2)) p = sorted(p, key=lambda i: i[0] - i[1]) x1, y1 = p[0] x2, y2 = p[-1] res = max(abs((x1 - y1) - (x2 - y2)), res) print(res)
p02556
s475021773
Accepted
N = int(input()) data1 = [] data2 = [] for i in range(N): x,y = map(int,input().split()) data1.append(x+y) data2.append(y-x) p = max(data1)-min(data1) q = max(data2)-min(data2) print(max(p,q))
p02556
s596185060
Accepted
import sys N = int(sys.stdin.readline()) points = [] for _ in range(N): x, y = map(int, sys.stdin.readline().split()) points.append((x, y)) f1 = [] f2 = [] for (x, y) in points: f1.append(x-y) f2.append(x+y) ans = max(max(f1) - min(f1), max(f2) - min(f2)) print(ans)
p02556
s504400005
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
s682483151
Accepted
n=int(input()) a=[] b=[] for i in range(n): x,y=list(map(int,input().split())) a.append(x+y) b.append(x-y) aaa=min(a) aaaa=max(a) bbb=min(b) bbbb=max(b) ans=[] ans.append(aaaa-aaa) ans.append(bbbb-bbb) ans.append(bbb) ans.append(bbbb) ans.append(aaa-aaaa) res=max(ans) print(res)
p02556
s929945022
Accepted
N = int(input()) XY = [list(map(int,input().split())) for _ in range(N)] w,z = [],[] for x,y in XY: w.append(x-y) z.append(x+y) a,b = max(w)-min(w),max(z)-min(z) print(max(a,b))
p02556
s810293513
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
s432211000
Accepted
import sys input = sys.stdin.readline n = int(input()) xy = [list(map(int, input().split())) for _ in range(n)] xy.sort() memo1 = [] memo2 = [] for x, y in xy: memo1.append(x+y) memo2.append(x-y) min1 = 10 ** 10 min2 = 10 ** 10 ans = 0 for i in range(n): ans = max(ans, memo1[i]-min1) ans = max(ans, memo2[i]-min2) min1 = min(min1, memo1[i]) min2 = min(min2, memo2[i]) print(ans)
p02556
s526934272
Accepted
import sys sys.setrecursionlimit(10**9) def mi(): return map(int,input().split()) def ii(): return int(input()) def isp(): return input().split() def deb(text): print("-------\n{}\n-------".format(text)) INF=10**20 def main(): N=ii() X = [] # x+y Y = [] # x-y for i in range(N): x,y=mi() X.append(x+y) Y.append(x-y) X.sort() Y.sort() ans = max(X[-1]-X[0],Y[-1]-Y[0]) print(ans) if __name__ == "__main__": main()