class

AtCoder::TwoSat

Inherits Reference / Object

Implements atcoder::two_sat

twosat = AtCoder::TwoSat.new(2_i64)
twosat.add_clause(0, true, 1, false)
twosat.add_clause(1, true, 0, false)
twosat.add_clause(0, false, 1, false)
twosat.satisfiable? # => true
twosat.answer       # => [false, false]

Constructors

new(size : Int64)
Source

Instance methods

add_clause(i, f, j, g)

Implements atcoder::two_sat.add_clause(i, f, j, g).

Source
answer

Implements atcoder::two_sat.answer().

This method will raise NotSatisfiableError if it's not satisfiable.

Source
satisfiable?

Implements atcoder::two_sat.satisfiable().

Source
size
Source

Nested types