Submission #16711687


Source Code Expand

Copy
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()

Submission Info

Submission Time
Task E - Dist Max
User charter
Language PyPy3 (7.3.0)
Score 500
Code Size 774 Byte
Status
Exec Time 1750 ms
Memory 146144 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample00, sample01
All 500 / 500 handmade02, handmade03, handmade04, handmade05, handmade06, handmade07, handmade08, handmade09, random07, random08, random09, random10, random11, random12, random13, random14, sample00, sample01
Case Name Status Exec Time Memory
handmade02 71 ms 62116 KB
handmade03 58 ms 62260 KB
handmade04 58 ms 62208 KB
handmade05 874 ms 142460 KB
handmade06 319 ms 141312 KB
handmade07 933 ms 141224 KB
handmade08 847 ms 141484 KB
handmade09 842 ms 141344 KB
random07 1670 ms 146132 KB
random08 1531 ms 146136 KB
random09 1651 ms 146144 KB
random10 1732 ms 146040 KB
random11 1748 ms 146044 KB
random12 1750 ms 146028 KB
random13 1672 ms 144808 KB
random14 1024 ms 115680 KB
sample00 68 ms 62288 KB
sample01 60 ms 62336 KB