题目描述
python
import sys
gird = []
for line in sys.stdin:
gird.append(line.split())
gird = [int(i) for i in gird[0]]
# print(gird)
#题解
n = len(gird)
dp = [1] * n
for i in range(n):
for j in range(i):
if gird[i] <= gird[j]:
dp[i] = max(dp[i],dp[j] + 1)
print(max(dp))
# 贪心 2
res = 0
for i in range(n):
k = 0
while k < res and gird[k] < gird[i]:k+=1
gird[k] = gird[i]
if k >= res:res+=1
print(res)