#P16223. 【模板】旋转卡壳/最远点对

    ID: 18257 远端评测题 5000ms 2048MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>计算几何Special Judge旋转卡壳双指针 two-pointer模板题闵可夫斯基和 Minkowski sum

【模板】旋转卡壳/最远点对

Background

This problem comes from the repository https://github.com/yosupo06/library-checker-problems.

Problem Description

This problem has TT cases.

Given N N 2D points pi(xi,yi) p_i (x_i, y_i) (0iN1)(0 \le i \le N - 1). Find a pair (i,j) (i, j) , such that ij i \ne j and $\text{dist}(p_i, p_j) = \max_{i \ne j} \text{dist}(p_i, p_j)$.

Here, dist\text{dist} denotes the Euclidean distance between two points.

Input Format

TT
NN
x0 y0x_0\ y_0
x1 y1x_1\ y_1
\vdots
xN1 yN1x_{N-1}\ y_{N-1}
NN
x0 y0x_0\ y_0
x1 y1x_1\ y_1
\vdots
xN1 yN1x_{N-1}\ y_{N-1}
\vdots

4
5
-1 -1
-6 4
-9 -7
2 5
-7 6
2
1 2
3 4
3
1 1
1 1
1 1
2
-1000000000 1000000000
1000000000 -1000000000
3 2
0 1
0 1
0 1

Hint

  • 1T105 1 \le T \le 10^5
  • 2N5×105 2 \le N \le 5 \times 10^5
  • xi,yi109 |x_i|, |y_i| \le 10^9
  • xi,yi x_i, y_i are integers
  • The sum of N N over all test cases does not exceed 5×105 5 \times 10^5