Category: Other

About Infinite Values
Other

About Infinite Values

Single Variable INF = 0x7fffffff The largest value of 32 bit signed int, which is $2^{32} - 1 = 2147483647 \approx{2.147 \times 10^{9}}$ LLINF = 0x7fffffffffffffff (15 fs) The largest value of 64 bit signed int, which is $2^{64} - 1 = 9223372036854775807 \approx{9.223 \times 10^{18}}$ memset() memset() works by bytes. For example, in C++, one int variable takes a room of 4 bytes. So when int var; memset(var, 0xab, sizeof(var)); and var == 0xabababab。 If it is an array, it works by every byte in every element in the array. It is the same as above. Common Settings memset(a, 0x3f, sizeof(a)) Similar to for(int i = 0; i <…

Some Templates
Other

Some Templates

Directory Data Structure Trie Tree Segment Tree On Graph Tarjan Tarjan Strongly Connected Components Tarjan Shrink Point Tarjan Cut Point and Bridge Shortest Path Floyd Dijkstra Numbers RMQ Problem by Sparse Table Tree Binary Search Tree Splay Diameter of A Tree Tree Chain Patition Data Structure Trie Tree #include<cstdio> #include<cstring> typedef long long llint; const bool DEBUG_ENABLE = 0; const int MAXN = 1e6 + 5; const int MOD = 19260827; struct TRIE { int nxt[MAXN][30], cnt; bool end[MAXN]; void insert(char str[]) { int now = 0, len = strlen(str); for(int i = 0; i < len; ++i) { int c = str[i] - 'a'; if(!nxt[now][c]) nxt[now][c] = ++cnt; now…