blob: 6dde73aa6ca32a11ad0c782cd5953f2e1cb99f84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#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 = min i, mit X[i] >= 10
return 0;
}
|