#P8404. [CCC 2022 J5] Square Pool

    ID: 9492 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 显示难度普及+/提高− 上传者: 标签>2022CCC(加拿大)

[CCC 2022 J5] Square Pool

Problem Description

Ron wants to build a square swimming pool in his n×nn \times n square yard, but there are TT trees in his yard.

Your task is to determine the side length of the largest square swimming pool he can build.

Input Format

The first line contains an integer nn, as described in the problem statement.

The second line contains an integer TT, as described in the problem statement.

The next TT lines each contain two integers x,yx, y, indicating that there is a tree at (x,y)(x, y).

Output Format

Output one line containing the maximum side length of the swimming pool.

5
1
2 4
3
15
8
4 7
4 1
14 11
10 6
13 4
4 10
10 3
9 14
7

Hint

Explanation for Sample 11:

Explanation for Sample 22:

Constraints:

For 20%20\% of the testdata: 1n50,T=11 \le n \le 50, T = 1.

For 35%35\% of the testdata: 1n50,1T101 \le n \le 50, 1 \le T \le 10.

For 25%25\% of the testdata: 1n5×105,1T101 \le n \le 5 \times 10^5, 1 \le T \le 10.

For 100%100\% of the testdata: 1n5×105,1T1001 \le n \le 5 \times 10^5, 1 \le T \le 100.

Translated by ChatGPT 5