- [NOIP1999 提高组] 导弹拦截
@C24kongxiangji
- 2025-4-6 18:38:46 @
#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;
}
Information
- ID
- 20
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- # Submissions
- 174
- Accepted
- 31
- Uploaded By