If this question is no limit power is obviously a bare 2-sat
considered limiting power also on FIG: i if power is selected, the power section that does not contain its point only is not selected, i.e., even side may be
but the number of such edges is built FIG o (n ^ 2), the need to optimize
the power section is divided into two, one in front of this point, another point behind this
same power will be fragmented into two points , these two sections are connected to the apparent power of the first type is a power point i must first subset i + 1 point, thus directly (i + 1) 1-> i1 will be the same token ( i-1) 2-> i2
1 #include<bits/stdc++.h> 2 using namespace std; 3 int main(){ 4 scanf("%d%d%d%d",&m1,&n,&m,&m2); 5 for(int i=1;i<=m1;i++){ 6 scanf("%d%d",&x,&y); 7 add(2*x-1,2*y); 8 add(2*y-1,2*x); 9 } 10 for(int i=1;i<=n;i++){ 11 scanf("%d%d",&x,&y); 12 add(2*n+2*x,2*i-1); 13 add(2*n+2*y-1,2*i-1); 14 } 15 for(int i=1;i<=m2;i++){ 16 scanf("%d%d",&x,&y); 17 add(2*x,2*y-1); 18 add(2*y,2*x-1); 19 } 20 for(int i=1;i<=p;i++){ 21 if (i<p)add(2*n+2*i-1,2*n+2*i+1); 22 if (1<i)add(2*n+2*i,2*n+2*i+2); 23 } 24 25 }