407732: GYM102888 G easy segment problem

Memory Limit:512 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. easy segment problemtime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard output

qxforever 有 n 条线段,每条线段的两个端点都在二维平面 xOy 上。他从每条线段上任取一点(可以是端点),并将这 n 个点的坐标相加,得到了一个新的点的坐标,称这个点为奇点

现在 qxforever 想知道,任意两个奇点之间距离的平方的最大值是多少?如果只有一个可能的奇点,答案为 0

正式地讲,在 n 条线段中,每条线段上任选两点 ai, bi(可以是端点,ai, bi 可以相同),定义

Input

第一行一个整数 n(1 ≤ n ≤ 2 × 105),表示线段的数量。

接下来 n 行,每行四个整数 x1, y1, x2, y2 (0 ≤ x1, x2, y1, y2 ≤ 103),表示线段的两个端点 (x1, y1), (x2, y2)。线段可能退化,即两个端点重合。

Output

输出一行一个整数,表示答案。可以证明答案是整数。

ExamplesInput
1
1 1 1 2
Output
1
Input
2
1 2 2 3
3 4 4 5
Output
8

加入题单

算法标签: