QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 1024 MB مجموع النقاط: 100 قابلة للهجوم ✓

#14233. 高塔

الإحصائيات

高度为 5 的极具美感的塔

你非常清楚“当生活给你积木时,就建起高楼吧!”这句俗话。所以,你决定正是要这样做。

你有 $n$ 个大小为 $l_i \times w_i \times 1$ 的积木(也就是说,每个积木的高度为 $1$ 个单位)。你想完全用完所有这些积木,使得塔的平均高度尽可能高。塔是用通常的方式建造的:将积木一个叠在另一个上面。

当然,你对美学有着独特的眼光,因此任意随机堆叠的积木在你眼里并不能算作一座塔。对于塔中的每一个积木(最底部的积木除外),你希望确保它比它下方的积木“恰好小了合适的程度”。更准确地说,当且仅当 $x \cdot l_k \le l_j \le y \cdot l_k$ 且 $x \cdot w_k \le w_j \le y \cdot w_k$ 时,你才能将积木 $j$ 放在积木 $k$ 的上方。保证 $0 < x \le y < 1$。

输入格式

输入的第一行包含三个空格分隔的正整数:积木数量 $n$($1 \le n \le 200$),$x'$($1 \le x' < 10^6$)和 $y'$($1 \le y' < 10^6$),其中 $x = \frac{x'}{10^6}$ 且 $y = \frac{y'}{10^6}$。保证 $x \le y$。

接下来有 $n$ 行,每行描述一个积木。第 $i$ 行包含两个空格分隔的正整数 $l_i$ 和 $w_i$,分别对应第 $i$ 个积木的长度和宽度。保证 $1 \le l_i, w_i \le 10^9$。

输出格式

输出一个整数,表示在使塔的平均高度最大化的积木排列中,塔的数量。可以证明答案是唯一的。

样例

输入样例 1

2 1 999999
5 4
1 3

输出样例 1

1

输入样例 2

8 1 999999
1 16
2 15
3 14
4 13
5 12
6 11
7 10
8 9

输出样例 2

8

输入样例 3

8 500000 500000
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8

输出样例 3

4

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.