Codeforcer's blog

By Codeforcer, history, 3 years ago, In English

When I try to use find by order using pairs in ordered_set of pbds it shows some error of no matching call as such. So how do I resolve it?

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll  long long
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define pi pair<int,int>
#define REP(i,n) for(int i=0;i<n;i++)
const int N = 2e5+2;
const ll mod = 1e9+7;
using namespace __gnu_pbds;

typedef tree<pi, null_type, less_equal<pi>, rb_tree_tag,
                    tree_order_statistics_node_update>
                    ordered_set;

ordered_set ord_set;

int main(){
	int a;
        cin >> a;
	ord_set.insert({a,-1});
	*ord_set.find_by_order(make_pair(a,-1)); //Why does this not work ?
   	ord_set.order_of_key({a,-1});
}

  • Vote: I like it
  • -25
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it +10 Vote: I do not like it

ord_set.find_by_order(0)

You need to provide the index in find_by_order.