版本比较
2-SAT(记录)
正文
增加 7 行删除 7 行
3 行未改动45678891011125 行未改动1819202122222324252612 行未改动39404142434344454647484950505152535425 行未改动8081828384848586878831 行未改动1201211221231241241251261271284 行未改动1331341351361371371381391401411423 行未改动#### (1)例如以下问题> $HDU~3062$ \> ——>[party](https://acm.hdu.edu.cn/showproblem.php?pid=3062)\> $也可以从这里$\> ——>[A-party](https://vjudge.net/contest/704558#problem/A) > ——>[A-party](https://vjudge.net/contest/704558#problem/A)
5 行未改动> $在这个题中$\> $我们知道如果A和B有矛盾的话$> $那么为了尽量满足前去n人去参加$> >> #### $我们就有了两种选择$> #### $①让 A和B' 去$> #### $②让 B和A'去$> #### $这样我们就不难想到$12 行未改动># (二)判断解是否存在> #### $然后我们去判断是否无解,如果有就进行有的操作$> #### $我们先判断是否无解$> >> #### $在这个题里无解即为两种$> #### $①矛盾同出现$> #### $②夫妻同出现$> #### $由于我们先前的存储方式,①即为解决了$> #### $再看(夫妻同出现的问题)$> #### $在这个题里,在我们的建图方法下$> >> #### $如果在一对夫妻里我们选谁,其伴侣都必须选的话$> #### $那即为无解,因为题目里要求了,夫妻不同现嘛$>
25 行未改动int main(){ ios::sync_with_stdio(false); cin.tie(0); while(cin>>n>>m){ while(cin>>n>>m){ for(int i=1;i<=m;i++){ //int a1=read(),a2=read(),c1=read(),c2=read(); int a1,a2,c1,c2; cin>>a1>>a2>>c1>>c2;31 行未改动 ins[u]=1; s[++top]=u; for(int i=0;i<v[u].size();i++){ int g=v[u][i]; if(!dfn[g]){//Q1,u->g if(!dfn[g]){//Q1,u->g tarjan(g); low[u]=min(low[u],low[g]); } else if(ins[g]){//Q2,u->g4 行未改动 ++ans; while(1){ scc[s[top]]=ans; ins[s[top]]=0; if(s[top--]==u)break;//Q4,->top位置不对 if(s[top--]==u)break;//Q4,->top位置不对 } } return ;} ```