File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 22// ! https://codeforces.com/blog/entry/4898
33// ! https://codeforces.com/blog/entry/60442
44// ! https://codeforces.com/blog/entry/129538
5- // ! p = probability of collision ~= 1/((1e9+7)*(1e9+9))
6- // ! probability of collision over q comparisons ~=
7- // ! (1 - (1/p))^q ~= 1 - (1/p)^q
5+ // ! probability of collision ~= 1/((1e9+7)*(1e9+9)) = 1/p
6+ // ! probability of no collision over q comparisons ~=
7+ // ! (1 - (1/p))^q ~= 1 - q/p
88// ! checking if n hashes are pairwise distinct is the same
9- // ! as doing q = (n choose 2) ~= n^2 comparisons
10- // ! - use random base to avoid getting hacked on codeforces
9+ // ! as doing q = (n choose 2) ~= n^2 comparisons
10+ // ! use random base to avoid getting hacked on codeforces
1111// ! @time O(n + q)
1212// ! @space O(n)
1313using hsh = array<ll, 2 >;
You can’t perform that action at this time.
0 commit comments