| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 141140 | 方文轩 | 最长连续上升子序列 | C++ | Output Limit Exceeded | 0 | 19 MS | 1044 KB | 629 | 2024-04-02 13:58:16 |
#include<bits/stdc++.h> using namespace std; int a[100005],b[100005],c[100005]; int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } int sum=0,cnt=1; for(int i=1;i<=n;i++){ if(a[i]<a[i+1]){ sum++; } else{ b[cnt]=sum+1; sum=0; if(a[i]<=a[i+2]){ c[cnt]=1; } cnt++; } } cnt--; int maxn=0; int ok=0; for(int i=1;i<=cnt;i++){ cout<<b[i]<<" "<<c[i]<<endl; if(c[i]==1){ maxn=max(maxn,b[i]+b[i+1]); ok=1; } } if(!ok){ maxn=0; for(int i=1;i<=cnt;i++){ maxn=max(maxn,b[i]); } cout<<maxn+1; return 0; } cout<<maxn; }