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.