Skip to content

Commit 20c104b

Browse files
committed
golf
1 parent 3387c7a commit 20c104b

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed
Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
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
};

0 commit comments

Comments
 (0)