GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 14 / 0 / 14
Functions: 100.0% 3 / 0 / 3
Branches: 100.0% 4 / 0 / 4

src/graph/sat2/lib.hpp
Line Branch Exec Source
1 #pragma once
2
3 #include "../scc/tarjan/lib.hpp"
4
5 namespace tifa_libs {
6
7 class sat2 {
8 cu32 n;
9 // vecptu e;
10 tarjan tj;
11 vvecu g;
12
13 public:
14 36 CEXPE sat2(u32 n) NE : n{n}, g(n * 2 + 1) {}
15
16 // $(c_x = v_x) \lor (c_y = v_y)$
17 6831143 CEXP void add(u32 x, bool vx, u32 y, bool vy) NE {
18 6831143 x = x * 2 + vx, y = y * 2 + vy;
19 // e.emplace_back(x ^ 1, y), e.emplace_back(y ^ 1, x);
20 6831143 g[x ^ 1].push_back(y), g[y ^ 1].push_back(x);
21 6831143 }
22 // @return a, a_i == 1 if c_i is true else a_i == 0
23 18 CEXP auto solve() NE {
24 18 tj.build(g);
25 18 std::optional ans{vecb(n)};
26
2/2
✓ Branch 0 taken 5669398 times.
✓ Branch 1 taken 13 times.
5669411 flt_ (u32, i, 0, n)
27
2/2
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 5669393 times.
5669398 if (tj.scc_id[i * 2] == tj.scc_id[i * 2 + 1]) {
28 5 ans = std::nullopt;
29 5 return ans;
30 5669393 } else ans.value()[i] = tj.scc_id[i * 2] > tj.scc_id[i * 2 + 1];
31 13 return ans;
32 }
33 };
34
35 } // namespace tifa_libs
36