Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <ext/pb_ds/assoc_container.hpp>
- #define all(a) a.begin(), a.end()
- #define forn(l, r) for(int i = l; i < (r); ++i)
- #define F first
- #define S second
- #define $ ios::sync_with_stdio(0);
- // #define int long long int
- using namespace std;
- using namespace __gnu_pbds;
- using ll = long long int;
- using ii = pair<int, int>;
- using li = pair<ll, int>;
- using vi = vector<int>;
- using graph = vector<vi>;
- using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
- /*
- ordered_set X;
- X.insert(1);
- X.insert(2);
- X.insert(4);
- X.insert(8);
- X.insert(16);
- cout<<*X.find_by_order(1)<<endl; // 2
- cout<<*X.find_by_order(2)<<endl; // 4
- cout<<*X.find_by_order(4)<<endl; // 16
- cout<<(end(X)==X.find_by_order(6))<<endl; // true
- // POSIÇÃO DA CHAVE X.LOWER_BOUND(A)
- cout<<X.order_of_key(-5)<<endl; // 0
- cout<<X.order_of_key(1)<<endl; // 0
- cout<<X.order_of_key(3)<<endl; // 2
- cout<<X.order_of_key(4)<<endl; // 2
- cout<<X.order_of_key(400)<<endl; // 5
- ORDERED MULTISET
- int t = 0;
- ordered_set me;
- me.insert({x, t++});
- me.erase(me.lower_bound({x, 0}));
- cout << me.order_of_key({x, 0}) << "\n";
- */
- mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
- const ll mod = 1000000007;
- const int INF = 0x3f3f3f3f;
- const int MAXN = 112345;
- // const double pi = 3.14159265359;
- const double eps = 0.00000001;
- int32_t main() {
- $
- }
Advertisement
Add Comment
Please, Sign In to add comment