题解 | #Redraiment的走法#
Redraiment的走法
https://www.nowcoder.com/practice/24e6243b9f0446b081b1d6d32f2aa3aa
#include <iostream> #include <unordered_set> #include <vector> #include <set> using namespace std; int main() { int n = 0; cin >> n; vector<int> v(n); for (int i=0;i<n;++i) { cin >> v[i]; } vector<int> dp(n,1); int imax = 1; for (int i=1;i<n;++i) { for (int j=0;j<i;++j) { if (v[i] > v[j] && dp[i] < dp[j] + 1) { dp[i] = dp[j] + 1; imax = max(imax, dp[i]); } } } cout << imax; }