/ GCOJ / 题库 /

Corral the Cows

Corral the Cows

暂无测试数据。

题目描述

Farmer John wishes to build a corral for his cows. Being finicky beasts, they demand that the corral be square and that the corral contain at least \(C\) clover fields for afternoon treats. The corral's edges must be parallel to the \(x, y\) axes.

FJ's land contains a total of \(N\) clover fields, each a block of size \(1 \times 1\) and located at with its lower left corner at integer \(X\) and \(Y\) coordinates each in the range \([1, 10000]\). Sometimes more than one clover field grows at the same location; such a field would have its location appear twice (or more) in the input. A corral surrounds a clover field if the field is entirely located inside the corral's borders.

Help FJ by telling him the side length of the smallest square containing \(C\) clover fields.

输入输出

Input #1

3 4
1 2
2 1
4 1
5 2

Output #1

4

数据范围

  • \(1 \leq C \leq N \leq 500\)

信息

ID
1030
难度
(无)
分类
(无)
标签
(无)
递交数
0
已通过
0
通过率
?
上传者