Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
140406 梁颢城 最长不下降子序列 C++ 运行出错 0 3 MS 356 KB 542 2024-03-30 15:05:51

Tests(0/10):


#include<bits/stdc++.h> using namespace std; bool cmp(int x,int y){ return x>y; } int n; int dp[10010]; int a[10010],tmp[10010]; signed main(){ cin >> n; for(int i = 1;i <= n;i++){ cin >> a[i]; } for(int i = 1;i <= n;i++){ for(int j = i+1;j <= n;j++){ cout << dp[a[i]] << endl; cout << a[j] << endl; cout << a[i] << endl; if(dp[a[i]] > 0){ break; } if(a[j] >= a[i]){ dp[a[i]]++; } } } sort(a+1,a+n+1,cmp); sort(dp+1,dp+a[1]+1,cmp); cout << dp[1]; return 0; }


测评信息: