@

#include<iostream>
#include<algorithm>
using namespace std;
int t,dp1[1919810],dp2[1919810],cnt1=-1,cnt2=-1;
bool cmp(const int &a,const int &b){
	return a>=b;
}
int main(){
	while(cin>>t){
		if(cnt1==-1||dp1[cnt1]>=t) dp1[++cnt1]=t;
		else *lower_bound(dp1,dp1+cnt1+1,t,cmp)=t;
		if(cnt2==-1||dp2[cnt2]<t) dp2[++cnt2]=t;
		else *lower_bound(dp2,dp2+cnt2+1,t)=t; 
	}
	cout<<cnt1+1<<endl<<cnt2+1;
	return 0;
}

1 comments

  • 1

Information

ID
20
Time
1000ms
Memory
256MiB
Difficulty
3
Tags
# Submissions
174
Accepted
31
Uploaded By