题目名称 1398. 最长上升子序列
输入输出 lis1.in/out
难度等级 ★☆
时间限制 1000 ms (1 s)
内存限制 256 MiB
测试数据 10
题目来源 Gravataryuan 于2013-09-11加入
开放分组 全部用户
提交状态
分类标签
动态规划 LIS 二分优化
分享题解
通过:654, 提交:1456, 通过率:44.92%
GravatarTA 100 0.000 s 0.00 MiB Pascal
Gravatar风吹我已散 100 0.000 s 0.00 MiB C++
Gravatar哒哒哒哒哒! 100 0.000 s 0.00 MiB C++
Gravatar哒哒哒哒哒! 100 0.000 s 0.00 MiB C++
Gravatar‎MistyEye 100 0.000 s 0.00 MiB C++
Gravatar‎MistyEye 100 0.000 s 0.00 MiB C++
GravatarYuri 100 0.000 s 0.00 MiB C++
GravatarYGOI_真神名曰驴蛋蛋 100 0.000 s 0.00 MiB C++
GravatarLOSER 100 0.000 s 0.00 MiB C++
GravatarGaoErFu 100 0.000 s 0.00 MiB C++
本题关联比赛
动态规划练习2
关于 最长上升子序列 的近10条评论(全部评论)
日常二分写错
Gravatarlihaoze
2022-02-13 23:32 38楼
································································································································································································································································································································································································································································································································
GravatarZooxTark➲
2020-01-31 14:21 37楼
Gravatarleon
2019-08-23 20:08 36楼
线段树是什么鬼
Gravatar李俊辉
2019-08-11 21:01 35楼
数据有问题,最后一个点中最长上升子序列为 0 1 2 3 4 5 6 7 8 9 10 56 96 101
0不是正整数;
这样会导致程序输出13(正解为14);
正在请求老师修复
Gravatar瑆の時間~無盡輪迴·林蔭
2018-11-01 16:44 34楼
写反了,很丢人
GravatarHale
2018-10-24 18:12 33楼
呵呵呵
Gravatar天网
2018-04-09 21:44 32楼
有毒吧
Gravatar天网
2018-04-09 21:33 31楼
大神看看为什么不对啊
GravatarShallowDream雨梨
2018-03-12 20:58 30楼
s[0]=-1,欲哭无泪
Gravatar
2017-12-11 15:05 29楼

1398. 最长上升子序列

★☆   输入文件:lis1.in   输出文件:lis1.out   简单对比
时间限制:1 s   内存限制:256 MiB

【题目描述】

设有整数序列A[1],A[2],A[3],…,A[m],若存在下标i1<i2<i3<…<in,且A[i1]<A[i2]<A[i3]<…<A[in],则称 序列A[1],A[2],A[3],…,A[m]中有长度为n的上升子序列A[i1] , A[i2] ,A[i3] ,…,A[in]。

请编程计算指定序列的最长上升子序列长度。

【输入格式】

第一行一个正整数n(n<1001),表示序列中整数个数;

第二行是空格隔开的n个整数组成的序列。

【输出格式】

一个正整数,表示输入文件中整数序列的最长上升子序列的长度。

【样例输入】

7
1 7 3 5 9 4 8

【样例输出】

4

【样例说明】

 序列(1,7,3,5,9,4,8)最长上升序列有:(1,3,5,9),(1,3,5,8),(1,3,4,8),他们长度为4。