HDU 1257 最小拦截系统——LIS

网友投稿 229 2022-11-01


HDU 1257 最小拦截系统——LIS

nlog的LIS

#include #include #include #include using namespace std;const int maxn = 1e5 + 10;int n, ans, a[maxn], b[maxn];int main() { while (cin >> n) { ans = 1; for (int i = 1; i <= n; i++) { cin >> a[i]; } int cnt = 0; b[++cnt] = a[1]; for (int i = 2; i <= n; i++) { if (b[cnt] < a[i]) { b[++cnt] = a[i]; } else { int pos = lower_bound(b + 1, b + 1 + cnt, a[i]) - b; b[pos] = a[i]; } } cout << cnt << endl; } return 0;}


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:CodeForces - 841C Leha and Function——思路题
下一篇:java jvm两种存储区的类型知识点讲解
相关文章

 发表评论

暂时没有评论,来抢沙发吧~