https://acs.jxnu.edu.cn/problem/CF4D

描述:

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决定给他来自澳大利亚的好朋友一个快乐的生日,并送给他一张贺卡。为了使他的礼物更加神秘,他决定做一个链条。链条是一系列的信封A={a1,a2,...,an},第i个信封的宽度和高度分别比第i-1个信封的宽度和高度更大。链条规模是指链条中的信封个数。

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.

Peter想要做一个他拥有的信封做成的最大数链条,链条应该能够将卡片放进去。卡片放入链条中如果他的宽度和高度要比链条中的最小信封的宽度和高度要小。禁止翻转卡片和信封。

Peter有非常多的信封和非常有限的时间,这个艰巨的任务就交给你了。

输入:

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).

第一行包含整数n,w,h (1  ≤ n ≤ 5000, 1 ≤ w,  h  ≤ 106)——分别表示信封的总数,卡片的宽度和高度。接下来n行,每一行包含两个整数wi和hi——信封的宽度和高度(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 

2022.02.05 Mysterious Present神秘的礼物相关推荐

  1. 力扣(LeetCode)36. 有效的数独(2022.02.05)

     请你判断一个 9 x 9 的数独是否有效.只需要 根据以下规则 ,验证已经填入的数字是否有效即可. 数字 1-9 在每一行只能出现一次. 数字 1-9 在每一列只能出现一次. 数字 1-9 在每一个 ...

  2. 洛谷 深基 第1部分 语言入门 第4章 循环结构程序设计(2022.02.14)

    P5718 [深基4.例2]找最小值 [深基4.例2]找最小值 - 洛谷 P5718 [深基4.例2]找最小值(python3实现)-2022.02.01 P5718 [深基4.例2]找最小值(pyt ...

  3. P5706 【深基2.例8】再分肥宅水--2022.02.13

    [深基2.例8]再分肥宅水 - 洛谷 C++代码: /* P5706 [深基2.例8]再分肥宅水--2022.02.13 https://www.luogu.com.cn/problem/P5706 ...

  4. P1029 [NOIP2001 普及组] 最大公约数和最小公倍数问题(2022.02.02) --- python3实现

    [NOIP2001 普及组] 最大公约数和最小公倍数问题 - 洛谷 """P1029 [NOIP2001 普及组] 最大公约数和最小公倍数问题(2022.02.02) h ...

  5. P1009 [NOIP1998 普及组] 阶乘之和-2022.02.01(python3实现)

    [NOIP1998 普及组] 阶乘之和 - 洛谷 """P1009 [NOIP1998 普及组] 阶乘之和-2022.02.01(python3实现) https://w ...

  6. 面试题 02.05. 链表求和

    面试题 02.05. 链表求和 给定两个用链表表示的整数,每个节点包含一个数位. 这些数位是反向存放的,也就是个位排在链表首部. 编写函数对这两个整数求和,并用链表形式返回结果. 示例: 输入:(7 ...

  7. 问题六十七:ray tracing学习总结(2016.11.13, 2017.02.05)

    从2016.11.13开始接触ray tracing到今天2017.02.05,差不多80天的时间.截至当前,学习ray tracing的过程,也是我重新找回自己或者说是"find what ...

  8. [CF4D]Mysterious Present

    4D:Mysterious Present 题意简述 给出一个限制 >(w,h) >(w,h)和 n n个物品的二维信息(xi,yi)(x_i,y_i). 求物品二维都满足限制的前提下,最 ...

  9. CF4D D. Mysterious Present

    做题链接: D. Mysterious Present 题目: 给出一个限制(w, h),和n个物品的二维信息(wi,hi)求物品二维都满足wi > w, hi > h的前提下的最长二维严 ...

最新文章

  1. 7 centos ssh 单机_centos7单机安装kafka
  2. 地理信息系统(GIS)
  3. 【Python】吊打pyecharts,又一超级棒的开源可视化库
  4. echarts控制只显示部分数据的折线图_Python数据可视化之pyecharts入门
  5. 继 SpringBoot 3.0,Elasticsearch8.0 官宣:拥抱 Java 17
  6. 钓鱼(信息学奥赛一本通-T1431)
  7. 14.面向对象-----UML类图
  8. AttributeError: module ‘xlwt‘ has no attribute ‘Workbook‘解决方案
  9. react项目中遇到的坑
  10. zedboard板子上呼吸灯的实现(第一版)仿真代码的实现
  11. 使用AvgPooling替换AdaptivePooling,池化padding,global average pooling 与 average pooling 的差别
  12. 为什么静态方法中不可以直接访问非静态方法?
  13. 【原创】启动Win10自带的XPS/OXPS阅读器
  14. CISSP考试指南笔记:1.2安全定义
  15. html5 楼盘效果图,楼盘效果图图集
  16. 网站根目录与服务器根目录,根目录在哪里_网站的根目录在哪?急急!!!
  17. html 磁贴自动布局,也来“玩”MetroUI之磁贴(一)_html/css_WEB-ITnose
  18. Struts2 的 s:property标签用法
  19. Phalanx——二维dp
  20. Linux指令_邓慧斐

热门文章

  1. google cash中文版
  2. 小程序源码:检讨书生成微信小程序
  3. cas37083-37-7/5,10,15,20-四(2,6-二氯苯基)卟吩;5-对( 4-溴丁氧基)苯基-10、15. 20三萃基卟啉的合成(筒称BrBPTPP,CgHsN,OBr )
  4. 使用调色板进行手机游戏开发
  5. JAVA毕业设计共享顺风车管理系统计算机源码+lw文档+系统+调试部署+数据库
  6. R语言数据处理学习记录--使用linkET包完成mental test
  7. c语言math未定义,C语言中自增自减表达式的未定义行为
  8. C语言限制双开关不同为1,网络环境下不同客户之间通信的C语言编程方法(第1稿)...
  9. War包反编译(转载)
  10. TCP 和 HTTP