File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed
library/math/matrix_related Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change 11#pragma once
22// ! https://codeforces.com/blog/entry/68953
33// ! https://codeforces.com/blog/entry/100066?#comment-887897
4- // ! @code
5- // ! basis<int> b1;
6- // ! basis<ll> b2;
7- // ! @endcode
84// ! b.shrink(v) == b.shrink(b.shrink(v))
9- // ! for x in b.b : (bit_floor(x)&b.shrink(v))==0
10- // ! for 0<=i<j<sz(b.b ): (bit_floor(b[i])&b[j])==0
11- // ! @time O(32) or O(64)
12- // ! @space O(32) or O(64)
13- template < class T > struct basis {
14- vector<T> b;
15- T shrink (T v) {
16- for (T x : b) v = min (v, v ^ x);
5+ // ! for x in b: (bit_floor(x)&b.shrink(v))==0
6+ // ! for 0<=i<j<sz(b): (bit_floor(b[i])&b[j])==0
7+ // ! @time O(32)
8+ // ! @space O(32)
9+ struct basis {
10+ vi b;
11+ int shrink (int v) {
12+ for (int x : b) v = min (v, v ^ x);
1713 return v;
1814 }
19- bool insert (T v) {
15+ bool insert (int v) {
2016 return (v = shrink (v)) ? b.push_back (v), 1 : 0 ;
2117 }
2218};
You can’t perform that action at this time.
0 commit comments