Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //int a[N];
- void compress()
- {
- set<int> s(a+1,a+1+n);
- vector<int> b(s.begin(),s.end());
- for(int i=1; i<=n; i++)
- {
- int x = a[i];
- int k = lower_bound(b.begin(),b.end(),x)-b.begin()+1;
- a[i] = k;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement