100206lbm @ 2023-07-01 20:33:50
#include<bits/stdc++.h>
using namespace std;
int i = 0, j, k, l, b[1001][1001], s, n;
int main()
{
cin >> n;
for(i = 1; i <= n; i++)
{
cin >> s;
b[i][1] = s;
b[i][2] = 1;
b[i][3] = 0;
}
for(i = n - 1; i <= n; i--)
{
l = k - 0;
for(j = i + 1; j <= n; j++)
{
if(b[j][i] > b[i][1] && b[j][2] > 1)
{
l = b[j][2];
k = j;
}
if(l > 0)
{
b[i][2] = l + 1;
b[i][3] = k;
}
}
}
k = 1;
for(j = 1; j <= n; j++)
if(b[j][2] > b[k][2]) k = j;
cout << b[k][2] << endl;
return 0;
}
by Sad_Rex @ 2023-07-01 20:47:29
(n≤5000)
by Sad_Rex @ 2023-07-01 20:47:37
@100206lbm
by 100206lbm @ 2023-07-01 20:56:09
thanks