HDU 1025-最长上升子序列
来源:互联网 发布:人工智能的龙头股 编辑:程序博客网 时间:2024/06/05 19:02
题目链接
包装了的最长上升子序列题目
#include <iostream> #include <cstring>#include <cstdio>#include <algorithm>#include <string>#include <string.h>#include <cmath>#include <sstream>#include <set>#include <map>#include <functional>#include <queue>#include <vector>using namespace std;const int maxn = 500010;const int INF=0x7fffffff;int arr[maxn], d[maxn];int n, res, pos;int main(){ int Case=0; while (~scanf("%d",&n)) { res = -1, pos = 0; for(int i=0;i<=n;i++) d[i]=INF; for (int i = 0; i < n; i++) { int a,b; scanf("%d%d",&a,&b); arr[a]=b; } for (int i = 1; i <= n; i++) { *lower_bound(d, d + n, arr[i]) = arr[i]; } pos=lower_bound(d, d + n, INF)-d; printf("Case %d:\n",++Case); if(pos==1) printf("My king, at most 1 road can be built.\n\n"); else printf("My king, at most %d roads can be built.\n\n",pos); }}
阅读全文
0 0
- HDU 1025 最长上升子序列
- 最长上升子序列(LIS)(HDU 1025)
- hdu 1025 最长严格上升子序列
- HDU 1025 最长上升子序列(nlogn)
- HDU 1025-最长上升子序列
- 【最长上升子序列O(nlgn)】HDU 1025
- HDU 1025 高效最长上升子序列(二分查)
- HDU-1025,最长上升子序列(nlogn)算法+详解
- hdu 1025 二分查找+最长上升子序列
- HDU-1025-动规-最长上升子序列
- hdu 1025 最长上升子序列+排序
- HDU 1025 最长上升子序列变形 (dp+二分)
- HDU 1025 (最长上升子序列(nlogn)算法)
- HDU 1423 最长上升公共子序列
- hdu 1423 最长公共上升子序列
- HDU 1257 最长上升子序列
- HDU 1087(最长上升子序列)
- HDU 1160(类似于最长上升子序列)
- 超全的Python学习路线图
- 梯度下降法的简单理解(含示例)
- Java--批量插入更新在一条sql里解决-mybatis-mysql-联合主键(建立唯一索引)
- go 正则的使用
- 第一个spark程序
- HDU 1025-最长上升子序列
- C++中clock用法
- Spring事务管理(详解+实例)
- NDK各个版本链接
- 7.分布式数据库HBase第3部分
- Android Studio 导入jar包 和 打包流程
- 状压dp学习笔记
- 码流 / 码率 / 比特率 / 帧速率 / 分辨率 / 高清的区别
- C++语言的函数重载、重写、覆盖的示例,及C++多态的两种方法