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 AC
Exec Time 1750 ms
Memory 146144 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 18
Set Name Test Cases
Sample sample00, sample01
All 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 AC 71 ms 62116 KB
handmade03 AC 58 ms 62260 KB
handmade04 AC 58 ms 62208 KB
handmade05 AC 874 ms 142460 KB
handmade06 AC 319 ms 141312 KB
handmade07 AC 933 ms 141224 KB
handmade08 AC 847 ms 141484 KB
handmade09 AC 842 ms 141344 KB
random07 AC 1670 ms 146132 KB
random08 AC 1531 ms 146136 KB
random09 AC 1651 ms 146144 KB
random10 AC 1732 ms 146040 KB
random11 AC 1748 ms 146044 KB
random12 AC 1750 ms 146028 KB
random13 AC 1672 ms 144808 KB
random14 AC 1024 ms 115680 KB
sample00 AC 68 ms 62288 KB
sample01 AC 60 ms 62336 KB