提交时间:2024-04-02 16:37:09
运行 ID: 141157
#include<bits/stdc++.h> using namespace std; const int N=100009; int w[N],m=1,maxn; int Left[N],Right[N]; int main(){ int n; cin>>n; Left[1]=1; Right[n]=1; for(int i=1;i<=n;i++)cin>>w[i]; for(int i=2;i<=n;i++){ if(w[i]>w[i-1])Left[i]=Left[i-1]+1; else Left[i]=1; } for(int i=n-1;i>=1;i--){ if(w[i+1]>w[i])Right[i]=Right[i+1]+1; else Right[i]=1; } for(int i=1;i<=n;i++){ if(w[i-1]<w[i+1]&&Left[i-1]+Right[i+1]>maxn)maxn=Left[i-1]+Right[i+1]); } cout<<maxn+1; }