Codeforces 4D Mysterious Present

English

Desc

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.

Input

The first line contains integers n, w, h (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).

Output

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.

Examples

input
2 1 1
2 2
2 2
output
1
1 

中文

简介

彼得决定向澳大利亚的朋友祝生日快乐,并给他发生日卡片。为了使他的礼物更神秘,他决定将卡片放多好 相互套用的信封里(就像俄罗斯套娃)。这里的链是这样的信封序列A  = { a1 ,   a2 ,…,   an },其中第i个信封的宽度和高度严格地高于(i   - 1)信封。链条尺寸是链条中的信封数量。

彼得想要从他所拥有的信封中获得最大尺寸的链条,链条应该是这样的,他可以把卡片放入。如果卡的宽度和高度分别低于链中最小信封的宽度和高度,卡适合链条。禁止转动卡片和信封。

彼得有很多信封和很少的时间,这个艰巨的任务是委托给你的。

输入格式

第一行包含整数 ,w,h(1≤  n  ≤5000,1≤ w,   h   ≤10 6) - ,分别彼得具有卡的宽度和高度的信封的数量。再有跟随n线,它们中的每包含两个整数 wi ħi -宽度和高度(1≤  wi ,   hi  ≤ 106 )。

输出格式

在第一行打印最大可以套几个。在第二行中,打印信封的id(以空格分隔),形成所需的链,以最小信封的数字开头。请记住,卡应该适合最小的信封。如果最大尺寸的信封id组合不是唯一的,请打印任何答案。

如果卡不适合任何信封,请在单行中打印数字0。

测试用例

测试输入
2 1 1
2 2
2 2
测试输出
1
1 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值