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

建议使用的浏览器:

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

6635:Nonsense Time

题目描述
You a given a permutation $p_1,p_2,\dots,p_n$ of size $n$. Initially, all elements in $p$ are frozen. There will be $n$ stages that these elements will become available one by one. On stage $i$, the element $p_{k_i}$ will become available.

For each $i$, find the longest increasing subsequence among available elements after the first $i$ stages.
输入解释
The first line of the input contains an integer $T(1\leq T\leq 3)$, denoting the number of test cases.

In each test case, there is one integer $n(1\leq n\leq 50000)$ in the first line, denoting the size of permutation.

In the second line, there are $n$ distinct integers $p_1,p_2,...,p_n(1\leq p_i\leq n)$, denoting the permutation.

In the third line, there are $n$ distinct integers $k_1,k_2,...,k_n(1\leq k_i\leq n)$, describing each stage.

It is guaranteed that $p_1,p_2,...,p_n$ and $k_1,k_2,...,k_n$ are generated randomly.
输出解释
For each test case, print a single line containing $n$ integers, where the $i$-th integer denotes the length of the longest increasing subsequence among available elements after the first $i$ stages.
输入样例
1
5
2 5 3 1 4
1 4 5 3 2
输出样例
1 1 2 3 3
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6635

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

共提交 0

通过率 --%
时间上限 内存上限
14000/14000MS(Java/Others) 524288/524288K(Java/Others)