ac-library-rb 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ac-library-rb/version.rb +1 -1
- data/lib/crt.rb +3 -1
- data/lib/dsu.rb +2 -2
- data/lib/fenwick_tree.rb +1 -1
- data/lib/two_sat.rb +3 -3
- data/lib_helpers/ac-library-rb.rb +24 -0
- data/lib_lock/ac-library-rb/crt.rb +3 -1
- data/lib_lock/ac-library-rb/dsu.rb +2 -2
- data/lib_lock/ac-library-rb/fenwick_tree.rb +1 -1
- data/lib_lock/ac-library-rb/two_sat.rb +3 -3
- metadata +4 -4
- data/lib_lock/ac-library-rb.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f7674ea5a0a95f6cad7945415632a06bf91a515cde31d1c08320d5e9561fc0e
|
4
|
+
data.tar.gz: d6bb650ec23b99f6180f5e8413644863dae78c7923d79249bcadcb9a8a1fcaa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d549b2be1fa15a519b8e1d692bbbd03ccd6c0f0b2d94787dbdc48c44ce9274c92ed5e7d6148c195ef73a545ba9951a64f74e84f39eed62e6c12a2eaaf386fcb9
|
7
|
+
data.tar.gz: 5f2b39beb3aacb21ac0fec142b550baf20b6343ed4fabce3ca303d8466bd632af71ce33d911b6a0494425234afa928949d33a670d490a91f9f5441c535586ae4
|
data/lib/crt.rb
CHANGED
data/lib/dsu.rb
CHANGED
data/lib/fenwick_tree.rb
CHANGED
data/lib/two_sat.rb
CHANGED
@@ -13,7 +13,7 @@ class TwoSAT
|
|
13
13
|
|
14
14
|
def add_clause(i, f, j, g)
|
15
15
|
unless 0 <= i && i < @n and 0 <= j && j < @n
|
16
|
-
raise
|
16
|
+
raise ArgumentError.new("i:#{i} and j:#{j} must be in (0...#{@n})")
|
17
17
|
end
|
18
18
|
|
19
19
|
@scc.add_edge(2 * i + (f ? 0 : 1), 2 * j + (g ? 1 : 0))
|
@@ -21,7 +21,7 @@ class TwoSAT
|
|
21
21
|
nil
|
22
22
|
end
|
23
23
|
|
24
|
-
def satisfiable
|
24
|
+
def satisfiable?
|
25
25
|
id = @scc.send(:scc_ids)[1]
|
26
26
|
@n.times do |i|
|
27
27
|
return false if id[2 * i] == id[2 * i + 1]
|
@@ -30,7 +30,7 @@ class TwoSAT
|
|
30
30
|
end
|
31
31
|
true
|
32
32
|
end
|
33
|
-
alias satisfiable
|
33
|
+
alias satisfiable satisfiable?
|
34
34
|
end
|
35
35
|
|
36
36
|
TwoSat = TwoSAT
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module AcLibraryRb
|
2
|
+
end
|
3
|
+
include AcLibraryRb
|
4
|
+
|
5
|
+
require_relative '../lib_lock/ac-library-rb/core_ext/all.rb'
|
6
|
+
|
7
|
+
require_relative '../lib_lock/ac-library-rb/convolution'
|
8
|
+
require_relative '../lib_lock/ac-library-rb/crt'
|
9
|
+
require_relative '../lib_lock/ac-library-rb/dsu'
|
10
|
+
require_relative '../lib_lock/ac-library-rb/fenwick_tree'
|
11
|
+
require_relative '../lib_lock/ac-library-rb/floor_sum'
|
12
|
+
require_relative '../lib_lock/ac-library-rb/inv_mod'
|
13
|
+
require_relative '../lib_lock/ac-library-rb/lazy_segtree'
|
14
|
+
require_relative '../lib_lock/ac-library-rb/lcp_array'
|
15
|
+
require_relative '../lib_lock/ac-library-rb/max_flow'
|
16
|
+
require_relative '../lib_lock/ac-library-rb/min_cost_flow'
|
17
|
+
require_relative '../lib_lock/ac-library-rb/modint'
|
18
|
+
require_relative '../lib_lock/ac-library-rb/pow_mod'
|
19
|
+
require_relative '../lib_lock/ac-library-rb/priority_queue'
|
20
|
+
require_relative '../lib_lock/ac-library-rb/scc'
|
21
|
+
require_relative '../lib_lock/ac-library-rb/segtree'
|
22
|
+
require_relative '../lib_lock/ac-library-rb/suffix_array'
|
23
|
+
require_relative '../lib_lock/ac-library-rb/two_sat'
|
24
|
+
require_relative '../lib_lock/ac-library-rb/z_algorithm'
|
@@ -14,7 +14,7 @@ module AcLibraryRb
|
|
14
14
|
|
15
15
|
def add_clause(i, f, j, g)
|
16
16
|
unless 0 <= i && i < @n and 0 <= j && j < @n
|
17
|
-
raise
|
17
|
+
raise ArgumentError.new("i:#{i} and j:#{j} must be in (0...#{@n})")
|
18
18
|
end
|
19
19
|
|
20
20
|
@scc.add_edge(2 * i + (f ? 0 : 1), 2 * j + (g ? 1 : 0))
|
@@ -22,7 +22,7 @@ module AcLibraryRb
|
|
22
22
|
nil
|
23
23
|
end
|
24
24
|
|
25
|
-
def satisfiable
|
25
|
+
def satisfiable?
|
26
26
|
id = @scc.send(:scc_ids)[1]
|
27
27
|
@n.times do |i|
|
28
28
|
return false if id[2 * i] == id[2 * i + 1]
|
@@ -31,7 +31,7 @@ module AcLibraryRb
|
|
31
31
|
end
|
32
32
|
true
|
33
33
|
end
|
34
|
-
alias satisfiable
|
34
|
+
alias satisfiable satisfiable?
|
35
35
|
end
|
36
36
|
|
37
37
|
TwoSat = TwoSAT
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ac-library-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- universato
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -123,8 +123,8 @@ files:
|
|
123
123
|
- lib/suffix_array.rb
|
124
124
|
- lib/two_sat.rb
|
125
125
|
- lib/z_algorithm.rb
|
126
|
+
- lib_helpers/ac-library-rb.rb
|
126
127
|
- lib_helpers/ac-library-rb/all.rb
|
127
|
-
- lib_lock/ac-library-rb.rb
|
128
128
|
- lib_lock/ac-library-rb/convolution.rb
|
129
129
|
- lib_lock/ac-library-rb/core_ext/all.rb
|
130
130
|
- lib_lock/ac-library-rb/core_ext/modint.rb
|
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
|
-
rubygems_version: 3.2.
|
170
|
+
rubygems_version: 3.2.22
|
171
171
|
signing_key:
|
172
172
|
specification_version: 4
|
173
173
|
summary: ac-library-rb is a ruby port of AtCoder Library (ACL).
|
data/lib_lock/ac-library-rb.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
module AcLibraryRb
|
2
|
-
end
|
3
|
-
include AcLibraryRb
|
4
|
-
|
5
|
-
require_relative './lib_lock/ac-library-rb/all.rb'
|
6
|
-
|
7
|
-
require_relative './ac-library-rb/convolution'
|
8
|
-
require_relative './ac-library-rb/crt'
|
9
|
-
require_relative './ac-library-rb/dsu'
|
10
|
-
require_relative './ac-library-rb/fenwick_tree'
|
11
|
-
require_relative './ac-library-rb/floor_sum'
|
12
|
-
require_relative './ac-library-rb/inv_mod'
|
13
|
-
require_relative './ac-library-rb/lazy_segtree'
|
14
|
-
require_relative './ac-library-rb/lcp_array'
|
15
|
-
require_relative './ac-library-rb/max_flow'
|
16
|
-
require_relative './ac-library-rb/min_cost_flow'
|
17
|
-
require_relative './ac-library-rb/modint'
|
18
|
-
require_relative './ac-library-rb/pow_mod'
|
19
|
-
require_relative './ac-library-rb/priority_queue'
|
20
|
-
require_relative './ac-library-rb/scc'
|
21
|
-
require_relative './ac-library-rb/segtree'
|
22
|
-
require_relative './ac-library-rb/suffix_array'
|
23
|
-
require_relative './ac-library-rb/two_sat'
|
24
|
-
require_relative './ac-library-rb/z_algorithm'
|