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