QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#21171. 負載平衡

Statistics

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$ 儘可能小。請幫他確定 $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.