当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5324:Boring Class

题目描述
Mr. Zstu and Mr. Hdu are taking a boring class , Mr. Zstu comes up with a problem to kill time, Mr. Hdu thinks it’s too easy, he solved it very quickly, what about you guys?
Here is the problem:
Give you two sequences ${L_1,L_2,...,L_n}$ and ${R_1,R_2,...,R_n}$.
Your task is to find a longest subsequence ${v_1,v_2,...v_m}$ satisfies
$v_1 \geq 1$,$v_m \leq n$,$v_i < v_{i+1}$ .(for i from 1 to m - 1)
$L_{v_i} \geq L_{v_{i+1}}$,$R_{v_i} \leq R_{v_{i+1}}$(for i from 1 to m - 1)
If there are many longest subsequence satisfy the condition, output the sequence which has the smallest lexicographic order.


输入解释
There are several test cases, each test case begins with an integer n.
$1 \leq n \leq 50000$
Both of the following two lines contain n integers describe the two sequences.
$1 \leq L_i,R_i \leq 10^9$
输出解释
For each test case ,output the an integer m indicates the length of the longest subsequence as described.
Output m integers in the next line.
输入样例
5
5 4 3 2 1
6 7 8 9 10
2
1 2
3 4
输出样例
5
1 2 3 4 5
1
1
来自杭电HDUOJ的附加信息
Author ZSTU
Recommend wange2014

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5324

最后修改于 2020-10-25T23:21:42+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/3000MS(Java/Others) 65536/65536K(Java/Others)