HDU 4421 Bit Magic (2-sat), hdu2-sat
HDU 4421 Bit Magic
Question Link
Based on the question, the B array is given to see if a suitable a array can be constructed.
Idea: consider each binary digit of each number separately, and it becomes a 2-sat question. Based on the formula in the question, create a 2-sat edge, then each digit runs 2-sat. If each digit matches YES, the other digit is NO.
Code:
#include <cstdio>#include <cstring>#include <cstdlib>#include <vector>#include <algorithm>using namespace std;const int MAXNODE = 505;struct TwoSet {int n;vector<int> g[MAXNODE * 2];bool mark[MAXNODE * 2];int S[MAXNODE * 2], sn;void init(int tot) {n = tot * 2;for (int i = 0; i < n; i += 2) {g[i].clear();g[i^1].clear();}memset(mark, false, sizeof(mark));}void add_Edge(int u, int uval, int v, int vval) {u = u * 2 + uval;v = v * 2 + vval;g[u^1].push_back(v);g[v^1].push_back(u);}void delete_Edge(int u, int uval, int v, int vval) {u = u * 2 + uval;v = v * 2 + vval;g[u^1].pop_back();g[v^1].pop_back();}bool dfs(int u) {if (mark[u^1]) return false;if (mark[u]) return true;mark[u] = true;S[sn++] = u;for (int i = 0; i < g[u].size(); i++) {int v = g[u][i];if (!dfs(v)) return false;}return true;}bool solve() {for (int i = 0; i < n; i += 2) {if (!mark[i] && !mark[i + 1]) {sn = 0;if (!dfs(i)){for (int j = 0; j < sn; j++)mark[S[j]] = false;sn = 0;if (!dfs(i + 1)) return false;}}}return true;}} gao;const int N = 505;int n, b[N][N];bool solve() {for (int k = 0; k < 31; k++) {gao.init(n);for (int i = 0; i < n; i++)for (int j = 0; j < n; j++) {int tmp = (b[i][j]>>k)&1;if (i == j) {if (tmp) return false;}else if (i % 2 == 1 && j % 2 == 1) {if (tmp) gao.add_Edge(i, tmp, j, tmp);else {gao.add_Edge(i, tmp, i, tmp);gao.add_Edge(j, tmp, j, tmp);}}else if (i % 2 == 0 && j % 2 == 0) {if (tmp) {gao.add_Edge(i, tmp, i, tmp);gao.add_Edge(j, tmp, j, tmp);} else gao.add_Edge(i, tmp, j, tmp);} else {if (tmp) {gao.add_Edge(i, tmp, j, tmp);gao.add_Edge(i, !tmp, j, !tmp);} else {gao.add_Edge(i, tmp, j, !tmp);gao.add_Edge(i, !tmp, j, tmp);}}}if (!gao.solve()) return false;}return true;}int main() {while (~scanf("%d", &n)) {for (int i = 0; i < n; i++)for (int j = 0; j < n; j++)scanf("%d", &b[i][j]);printf("%s\n", solve() ? "YES" : "NO");}return 0;}
What are the targeted bactericidal problems between 1, 2-dibromo-3-ketone (BIT) and 2, 2-dibromo-3-cyanamide (DBNPA?
The BIT sterilization mechanism is the same as that of photaine, that is, the isothiazoryan compounds have a strong penetration ability on the receptor cell membrane and cell wall, after penetrating the peripheral of the cell, it can interact with the protein, enzyme or simple molecule containing sulfur in the cell to break the S-N key, thus forming a S-S key with the receptor and damaging the normal function of the cell. Obviously, it can be concluded that the weaker the S-N bond of isothiazorclone is, the better it is for antibacterial.
The sterilization mechanism of DBNPA is to act on certain protein groups to terminate normal oxidative reduction of cells, and its branches can also selectively drop out or oxidized special enzyme metabolism of microorganisms, which eventually leads to cell death.
I personally think that both of them are effective for sulfate-reducing bacteria, but DBNPA has a faster bactericidal effect and a lower concentration, but DBNPA is not as stable as BIT. Both of them are decomposed when hydrogen sulfide exists, however, BIT is more stable than DBNPA in alkaline conditions.
BIT has more application in coatings and more application in the back-injection water of oilfield.
The rotten bacteria are species of different cultures, bacteria, and fungi, and most of them are anaerobic fungi. Both of them are broad-spectrum fungicides.
Java (TM) 6 Update 27 in Windows 7 is dry, java (TM) 6 update 24 (64-bit), the two can be deleted
These two are the java runtime environments. After deletion, the java program cannot be run,