QOJ.ac

QOJ

时间限制: 2 s 内存限制: 256 MB 总分: 100

#21171. 負荷分散

统计

Farmer John の $N$ 頭の牛は二次元の農場の異なる位置 $(x_1, y_1) \ldots (x_n, y_n)$ に立っています($1 \leq N \leq 100,000$、$x_i$ と $y_i$ は $1,000,000$ 以下の正の奇数)。FJ は長い(実質無限長の)南北方向の柵 $x=a$ で農場を分けたいと考えています。$a$ は偶数の整数なので牛の位置を通りません。さらに長い(実質無限長の)東西方向の柵 $y=b$ を作り、$b$ も偶数の整数です。二つは $(a,b)$ で交わり、農場を四つの領域に分けます。

FJ はどの領域にも牛が多すぎず、四領域が適度に「均衡」するよう $a$ と $b$ を選びたいと考えています。四領域の牛の数の最大値を $M$ とし、これをできるだけ小さくしたいのです。$M$ の最小値を求めてください。

入力

最初の行に整数 $N$ が与えられます。次の $N$ 行はそれぞれ一頭の位置を $x$、$y$ 座標の順に与えます。

出力

柵を最適に置いて達成できる $M$ の最小値を出力してください。

入出力例

入力 1

7
7 3
5 5
7 13
3 1
11 7
5 3
9 1

出力 1

2

問題作成者:Brian Dean

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.