Hdu4421 bit magic [2-Sat]

Source: Internet
Author: User

Description:


This matrix is given, and the original A array is obtained.


2-SAT questions: run one side for each digit and 31 for each digit.

Edge Creation


Note n = 1 and check whether the symmetric elements are the same.


# include # include # include # include # include # include # define Pb push_back # include using namespace STD; int V; const int max_v = 1111; vector G [max_v]; vector RG [max_v]; vector vs; bool used [max_v]; int CMP [max_v]; void add_edge (int from, int) {// cout " = 0; I --) if (! Used [vs [I]) RDFS (vs [I], K ++); For (INT I = 0; I now) & 1; if (I & 1) & (J & 1 )) {If (Num) {add_edge (I + N, J); add_edge (J + N, I);} else {add_edge (I, I + n); add_edge (J, J + n) ;}} else if (! (I & 1 )&&! (J & 1) {If (Num) {add_edge (I + N, I); add_edge (J + N, J);} else {add_edge (I, J + n); add_edge (J, I + n) ;}} else {If (Num) {add_edge (I, j + n); add_edge (J + N, i); add_edge (I + N, J); add_edge (J, I + n);} else {add_edge (I, j); add_edge (J, I ); add_edge (I + N, J + n); add_edge (J + N, I + n) ;}}for (INT I = 0; I <2 * N; I ++) for (Int J = 0; j % d \ n", I, G [I] [J]); SCC (); for (INT I = 0; I


hdu4421 bit magic [2-Sat]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.