Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int T, N, x, len;
- int main()
- {
- cin>>T;
- while(T--){
- set<int> s;
- len = 0;
- cin>>N;
- for(int i=0; i<N; ++i){
- cin>>x;
- auto st = s.begin();
- if(s.lower_bound(x) == s.end()){
- s.insert(x);
- len++;
- }
- else{
- auto lt = s.lower_bound(x);
- s.erase(lt);
- s.insert(x);
- }
- }
- cout<<len<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement