Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
165099 陈开远 【一维数组】数组元素移动(1) C++ Wrong Answer 0 MS 264 KB 611 2026-11-09 20:21:59

Tests(0/1):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int a[201],n,dp[201]; int main() { cin >> n; int ans=1; for(int i=1; i<=n; i++) { cin>>a[i]; } dp[n]=1; for(int i=n-1; i>=1; i--) { int mx=0; for(int j=i+1; j<=n; j++) { if(a[i]<=a[j]) { dp[i]=max(dp[j]+1,dp[i]); } } if(dp[i]==0){ dp[i]=1; } if(dp[i]>ans) { ans=dp[i]; } } cout<<"max="<<ans; return 0; }


Run Info:

------Input------
5 -1 -2 -3 -4 -5
------Answer-----
-5 -1 -2 -3 -4
------Your output-----
max=1