Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <vector>
- using namespace std;
- ifstream f("gogosi.in");
- ofstream g("gogosi.out");
- vector<int> a;
- int n,x,st,dr,mij;
- int main()
- {
- f>>n;
- for(int i=0;i<n;++i)
- {
- f>>x;
- st=0;
- dr=a.size()-1;
- while(st<=dr)
- {
- mij=(st+dr)/2;
- if(a[mij]<=x)
- dr=mij-1;
- else
- st=mij+1;
- }
- if(st==(int)a.size())
- a.push_back(x);
- else
- a[st]=x;
- }
- g<<a.size();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement