版本比较
🦝 | CF1210F2
正文
增加 3 行删除 3 行
42 行未改动4344454647474849505152535454555657585959606162635 行未改动42 行未改动 for (int i = 0; i < n; i ++) if (s >> i & 1) (no[s][t] *= b[i][j]) %= P, (res *= b[i][j]) %= P; (yes[s][t] *= P + 1 - res) %= P; }
if (!s) yes[s][t] = 1; }
for (int s = 0; s < (1 << n); s ++) for (int t = 0; t < (1 << n); t ++) { bool flg = popc(s) <= popc(t); int res = yes[s][t]; int res = yes[s][t]; subset(s, s0) subset(t, t0) if (popc(s0) - popc(t0) >= popc(s) - popc(t) || flg) { int s1 = s ^ s0, t1 = t ^ t0; (res += P - g[s0][t0] * f[s1][t1] % P * no[s0][t1] % P) %= P; } }
(flg ? f : g)[s][t] = res; }
5 行未改动