题解 | #Redraiment的走法#
Redraiment的走法
https://www.nowcoder.com/practice/24e6243b9f0446b081b1d6d32f2aa3aa
while 1: try: n = int(input()) high = list(map(int, input().split())) memory = {} def L(h, i): if i in memory: return memory[i] if i == len(h) - 1: return 1 max_len = 1 for j in range(i + 1, len(h)): if h[i] < h[j]: max_len = max(max_len, L(h, j) + 1) memory[i] = max_len return max_len record_list = [] for i in range(n): record_list.append(L(high, i)) print(max(record_list)) except: break