python
def main():
f = [0] * (10 + n)
g = [0] * (10 + n)
for i in range(1, n + 1):
if a[i] > a[i - 1]:
f[i] = f[i - 1] + 1
else:
f[i] = 1
for i in range(n, 0, -1):
if a[i] < a[i + 1]:
g[i] = g[i + 1] + 1
else:
g[i] = 1
res = 0
for i in range(1, n + 1):
if a[i - 1] > a[i + 1]:
res = max(res, max(f[i - 1], g[i + 1]))
else:
res = max(res, f[i - 1] + g[i + 1])
return res
if __name__ == '__main__':
n = int(input())
a = list(map(int, input().split()))
a.insert(0, 0)
a.append(0)
print(main())
大佬,这个有没有视频讲解呢?