0pts
查看原帖
0pts
916380
yyjw14楼主2023/11/25 16:44
	#include<bits/stdc++.h>
	using namespace std;
	const int N = 1e5+5;
	int a[N],dp[N];
	int main()
	{
		ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
		int i=1,j,k;
		while(cin>>j)
		{
			a[i]=j;
			dp[i ++]=1;
		}
		--i; 
		for(j=i-1;j>=1;--j)
		{
			int mxn=0;
			for(k=j+1;k<=i;++k)
			{
				if(a[k]<a[j])
				{
					mxn=max(mxn,dp[k]);
				}
			}
			dp[j]=mxn+1;
		}
		cout<<*max_element(dp+1,dp+i+1)<<'\n';
		int ans=1;
		for(j=2;j<=i;++j)
		{
			if(a[j]>a[j-1])
			{
				ans++;
			}
		}
		cout<<ans;
		return 0;
	
	}
2023/11/25 16:44
加载中...