Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #include<ext/pb_ds/assoc_container.hpp>
- #include<ext/pb_ds/tree_policy.hpp>
- using namespace __gnu_pbds;
- #define ll long long
- typedef tree<
- pair<ll,ll>,
- null_type,
- greater<pair<ll,ll> >,
- rb_tree_tag,
- tree_order_statistics_node_update> set_t;
- int main()
- {
- set_t arnob;
- arnob.insert(make_pair(5,10));
- arnob.insert(make_pair(1,9));
- arnob.insert(make_pair(7,9));
- arnob.insert(make_pair(5,7));
- for(auto x : arnob){
- cout<<x.first<<' '<<x.second<<endl;
- }cout<<endl;
- pair<ll,ll> pp = *(arnob.find_by_order({2}));
- cout<<pp.first<<' '<<pp.second<<endl;
- cout<<arnob.order_of_key(pp)<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement