CF4D--Mysterious Present翻译

原题链接--

https://acs.jxnu.edu.cn/problem/CF4Dicon-default.png?t=M0H8https://acs.jxnu.edu.cn/problem/CF4D 

Mysterious Present

 1000ms  65536K

描述:

Peter decided to wish happy birthday to his friend from Australia and send him a card. To make his present more mysterious, he decided to make a chain. Chain here is such a sequence of envelopes A = {a1,  a2,  ...,  an}, where the width and the height of the i-th envelope is strictly higher than the width and the height of the (i  -  1)-th envelope respectively. Chain size is the number of envelopes in the chain.

Peter wants to make the chain of the maximum size from the envelopes he has, the chain should be such, that he'll be able to put a card into it. The card fits into the chain if its width and height is lower than the width and the height of the smallest envelope in the chain respectively. It's forbidden to turn the card and the envelopes.

Peter has very many envelopes and very little time, this hard task is entrusted to you.

译文: 皮特决定祝愿来自澳大利亚的朋友生日快乐并且寄给他一张卡片。为了使他的礼物更神秘,他决定做一条链子。链子是一连串的信封A={a1,a2,...,an},其中第i个信封的宽度和高度分别严格高于第(i-1)个信封的宽度和高度。链子的大小是链子中信封的数量。

皮特想从他有的信封中做一条最大的链子,链子应该能够放一张卡片进去。如果卡片的宽度和高度分别小于最小信封的宽度和高度就能放进链子里。禁止翻动卡片和信封。

皮特有许多信封和很少的时间,这个困难的任务就委托给了你。

输入:

The first line contains integers nwh (1  ≤ n ≤ 5000, 1 ≤ w,  h  ≤ 106) — amount of envelopes Peter has, the card width and height respectively. Then there follow n lines, each of them contains two integer numbers wi and hi — width and height of the i-th envelope (1 ≤ wi,  hi ≤ 106).

译文:第一行包含整数 nwh (1  ≤ n ≤ 5000, 1 ≤ w,  h  ≤ 106) —皮特有的信封数,卡片的宽度和高度。接下来n行,每行包含两个整数wi,hi —第i个信封的宽度和高度(1 ≤ wi,  hi ≤ 106)。

输出:

In the first line print the maximum chain size. In the second line print the numbers of the envelopes (separated by space), forming the required chain, starting with the number of the smallest envelope. Remember, please, that the card should fit into the smallest envelope. If the chain of maximum size is not unique, print any of the answers.

If the card does not fit into any of the envelopes, print number 0 in the single line.

译文:第一行打印链子最大的大小。第二行打印信封的数量(用空格分隔),要求的链子由最小的信封的数字开始。请记住,卡片应该适合最小的信封。如果链子的最大的大小不唯一,打印任何一个答案。

如果卡片不适合最小的信封,在单独的一行打印0。

样例输入:

2 1 1
2 2
2 2

样例输出:

1
1 

样例输入:

3 3 3
5 4
12 11
9 8

样例输出:

3
1 3 2 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值