您当前的位置: 首页 > 

*DDL_GzmBlog

暂无认证

  • 0浏览

    0关注

    605博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

P1005: 序列 dp+离散化

*DDL_GzmBlog 发布时间:2022-03-19 17:34:57 ,浏览量:0

思路

离散化之后查找最多的一个即可

Mycode
//��һ�δ��Ϻ�վ֮�� ��Ϊʹ��#define int long long TLE���¿��˺ܾõ�ʱ�� ���˼���ģ��
//����ʹ�ø��ӵ�ģ��

#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
#define IOS  ios::sync_with_stdio(false);
#define CIT  cin.tie(0);
#define COT  cout.tie(0);

#define ll long long
#define x first
#define y second
#define pb push_back
#define endl '\n'
#define all(x) (x).begin(),x.end()
#define Fup(i,a,b) for(int i=a;i=b;i--)

typedef priority_queue  Pri_m;
typedef pair pii;
typedef vector VI;
map mp;

const int N  = 1e5+10;
int n,a[N],b[N];
int f[N];

void solve()
{
	cin>>n;
	for(int i=1;i>a[i];
		b[i] = a[i];
	}
	
	sort(a+1,a+1+n);
	int len = unique(a+1,a+1+n)-a-1;
	
	Fup(i,1,len)
	mp[a[i]] = i ;
	
	Fup(i,1,n)
	b[i] = mp[b[i]];
	
	int maxn = 0 ;
	int ans = 0 ;
	
	Fup(i,1,n){
		int now = b[i];
		int ans = 0 ;
		if(!now){
			ans = f[0];
		}else ans =max(f[now],f[now-1]);
		++ans;
		maxn = max(maxn,ans);
		f[now] = ans;
	}
	
	cout            
关注
打赏
1657615554
查看更多评论
0.0349s