MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / assume

Method assume

code/other/dpll.cpp:15–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13 iter(it,seen) cl.push_back(*it);
14 tail.push_back((int)cl.size() - 2); }
15 bool assume(int x) {
16 if (val[x^1]) return false;
17 if (val[x]) return true;
18 val[x] = true; log.push_back(ii(-1, x));
19 rep(i,0,w[x^1].size()) {
20 int at = w[x^1][i], h = head[at], t = tail[at];
21 log.push_back(ii(at, h));
22 if (cl[t+1] != (x^1)) swap(cl[t], cl[t+1]);
23 while (h < t && val[cl[h]^1]) h++;
24 if ((head[at] = h) < t) {
25 w[cl[h]].push_back(w[x^1][i]);
26 swap(w[x^1][i--], w[x^1].back());
27 w[x^1].pop_back();
28 swap(cl[head[at]++], cl[t+1]);
29 } else if (!assume(cl[t])) return false; }
30 return true; }
31 bool bt() {
32 int v = log.size(), x; ll b = -1;
33 rep(i,0,n) if (val[2*i] == val[2*i+1]) {

Callers

nothing calls this directly

Calls 2

push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected