7分求调(玄关
查看原帖
7分求调(玄关
1072849
Walkzz楼主2025/1/18 18:33
#include<bits/stdc++.h>
#define F(i,a,b) for(register int i=a;i<=b;i=-~i)
using namespace std;const int MAXN=250;
int n,a[MAXN],f[MAXN][MAXN],maxa;
main(){
	cin>>n;
	F(i,1,n){cin>>a[i];f[i][i]=a[i];}
	F(i,1,n)F(j,i,n)F(k,i,j){
//		int k=(i+j)>>1;
		if(f[i][k]==f[k+1][j])f[i][j]=max(f[i][j],f[i][k]+1);
		maxa=max(maxa,f[i][j]);
	}cout<<maxa;
}
2025/1/18 18:33
加载中...