-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTemplate_gnu_ds.cpp
More file actions
52 lines (45 loc) · 1.44 KB
/
Template_gnu_ds.cpp
File metadata and controls
52 lines (45 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#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;
// incomplete
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> cd;
struct custom_hash {
// From https://codeforces.com/blog/entry/62393
const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
static uint64_t splitmix64(uint64_t x) {
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const {
return splitmix64(x + FIXED_RANDOM);
}
size_t operator()(pii x) const {
return splitmix64( x.first ^ (x.second>>1) + FIXED_RANDOM );
}
};
unordered_map<long long, int, custom_hash> safe_map;
// Regular ol' unorderedmap
gp_hash_table<long long, int, custom_hash> safe_hash_table;
// Supports .find(), []++
tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// Supports .order_of_key(x), counts number of elements less than x.
// Supports .find_by_order(n), returns iterator to nth element (0-indexed)
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while(t--){
;
}
}