听取TLE声一片
评测记录
代码
#include <bits/stdc++.h>
using namespace std;
const int N=5e5+25;
int main()
{
long long i=1,j,k,x,n=0,maxx,m=0,a[N]={0},b[N]={0},h[N]={0};
while(cin>>a[i])
{
maxx=0;
for(j=1;j<=i;j++)
if(a[j]>=a[i])
if(b[j]>maxx)
maxx=b[j];
b[i]=maxx+1;
if(b[i]>m) m=b[i];
x=0;
for(k=1;k<=n;k++)
if(h[k]>=a[i])
if(x==0) x=k;
else if(h[k]<h[x]) x=k;
if(x==0)
{
n++;
x=n;
}
h[x]=a[i];
i++;
}
cout<<m<<endl;
cout<<n<<endl;
}
qwq __