Skip to content

Instantly share code, notes, and snippets.

@monhime

monhime/ABC178E.gyp

Created Sep 13, 2020
Embed
What would you like to do?
ABC178 E問題 解答
import sys
def input(): return sys.stdin.readline().rstrip()
from operator import itemgetter
def main():
n = int(input())
XY = [tuple(map(int,input().split())) for i in range(n)]
XY.sort()
ans = 0
SXY = [[0,0,0] for i in range(n)]
for i in range(n):
SXY[i][0] = XY[i][0] + XY[i][1]
SXY[i][1] = XY[i][0]
SXY[i][2] = XY[i][1]
SXY.sort()
ans = abs(SXY[0][1]-SXY[-1][1])+abs(SXY[0][2]-SXY[-1][2])
SXY = [[0,0,0] for i in range(n)]
for i in range(n):
SXY[i][0] = XY[i][1] - XY[i][0]
SXY[i][1] = XY[i][0]
SXY[i][2] = XY[i][1]
SXY.sort()
ans = max(ans,abs(SXY[0][1]-SXY[-1][1])+abs(SXY[0][2]-SXY[-1][2]))
print(ans)
if __name__=='__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.