Skip to content

thatisnotobvio/Coding-Library

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coding Library

By failed_coder

https://math.stackexchange.com/questions/2956889/how-many-number-of-integer-coordinates-exists-between-a-line-segment-including

Number of trees with n labeled vertices = n^(n-2) . Link - (https://en.wikipedia.org/wiki/Cayley%27s_formula)

https://proofwiki.org/wiki/Sum_of_r%2Bk_Choose_k_up_to_n

Smallest Enclosing Circle. Link - ( https://codeforces.com/blog/entry/23554 )

a+b=a⊕b+2×(a and b)=(a or b)+(a and b)

Dilworth's theorem states that, in any finite partially ordered set, the largest antichain has the same size as the smallest chain decomposition.

Set bits xor pairsum . Link - ( https://atcoder.jp/contests/abc091/submissions/11263481 )

Policy Based data structure

OrderedSet

(Use as multiset)

#include <ext/pb_ds/assoc_container.hpp> // Common file

#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace __gnu_pbds;

typedef tree<ll, null_type, less_equal, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

order_of_key -> find element less than x

find_order_by -> returns iterator to kth largest element counting from 0.

lower bound works as upper bound

Normal set

typedef tree<ll, null_type, less, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

Fast Hash in cpp

const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();

struct chash { int operator()(int x) const { return x ^ RANDOM; }};

cc_hash_table<int, int, hash> cnt;

About

CODE LIBRARY (TEMPLATES)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • C++ 100.0%