[CCC 2022 J5] Square Pool

Luogu
IDLGP8404
Time1000ms
Memory128MB
DifficultyP4
2022CCC(加拿大)
罗恩想在他的 $n\times n$ 的正方形院子里建一个正方形游泳池,但他的院子里有 $T$ 棵树。 你的任务是确定他可以建造的最大的方形游泳池的边长。 ## Input 第一行一个整数 $n$ ,具体意义见题目描述。 第二行一个整数 $T$ ,具体意义见题目描述。 接下来 $T$ 行,每行两个整数 $x,y$ ,表示在 $(x,y)$ 上有一棵树。 ## Output 一行,表示游泳池的最大边长。 [samples] ## Note 样例 $1$ 解释: ![](https://cdn.luogu.com.cn/upload/image_hosting/c2b58ek8.png) 样例 $2$ 解释: ![](https://cdn.luogu.com.cn/upload/image_hosting/r7uoub7n.png) 对于 $20\%$ 的数据:$1\le n\le 50,T=1$ 对于 $35\%$ 的数据:$1\le n\le 50,1\le T\le 10$ 对于 $25\%$ 的数据:$1\le n\le 5\times 10^5,1\le T\le 10$ 对于 $100\%$ 的数据:$1\le n\le 5\times 10^5,1\le T\le 100$
Samples
Input #1
5
1
2 4
Output #1
3
Input #2
15
8
4 7
4 1
14 11
10 6
13 4
4 10
10 3
9 14
Output #2
7
API Response (JSON)
{
  "problem": {
    "name": "[CCC 2022 J5] Square Pool",
    "description": {
      "content": "罗恩想在他的 $n\\times n$ 的正方形院子里建一个正方形游泳池,但他的院子里有 $T$ 棵树。 你的任务是确定他可以建造的最大的方形游泳池的边长。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 131072
    },
    "difficulty": {
      "LuoguStyle": "P4"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP8404"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "罗恩想在他的 $n\\times n$ 的正方形院子里建一个正方形游泳池,但他的院子里有 $T$ 棵树。\n\n你的任务是确定他可以建造的最大的方形游泳池的边长。\n\n## Input\n\n第一行一个整数 $n$ ,具体意义见题目描述。\n\n第二行一个整数 $T$ ,具体意义见题目描述。\n\n接下来 $T$ 行,每行两个整数 $x,y$ ,表示在 $(x,y)$ 上有一棵树。\n\n## Output\n\n一行,表示...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments