blob: a20b0dcf577837e2dd707436902d1dcd9310411e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std; using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> Tree;
int main() {
Tree X;
for (int i = 1; i <= 16; i <<= 1) X.insert(i); // {1, 2, 4, 8, 16}
cout << *X.find_by_order(3) << endl; // => 8
cout << X.order_of_key(10) << endl; // => 4 = Nachfolger von 10 = minimales i, sodass X[i] >= 10
return 0;
}
|