#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#define ll long long
#define lowbit(x) ((~x+1)&x)
using namespace std;
const int N = 1e3+10;
int n,k;
int main() {
cin>>n;
set<int>s;
for(int i=1; i<=n; i++) {
cin>>k;
set<int>::iterator it = s.lower_bound(k);
// set<int>::iterator it=lower_bound(s.begin(),s.end(),k);
if(it!=s.end()) {
s.erase(it);
s.insert(k);
}
else s.insert(k);
}
cout<<s.size()<<endl;
return 0;
}
这个题好恶心,为什么我用< algorothm >里的lower_bound查找会超时,然而用set里的lower_bound就过了,求大佬告知😭。