2-sat
Master.Yi
学习他人,提升自己;
提升自己,帮助他人。
展开
-
NOI2017 游戏【2-sat】
题目描述:洛谷链接题目分析:咕咕咕。。算是2-sat裸题吧。。就枚举一下xxx是aaa还是bbb就可以了,已经包含了所有情况,没必要枚举ccc了。O(2d∗(n+m))O(2^d*(n+m))O(2d∗(n+m))主要是存存代码。2-sat多组数据的时候注意scc也要清空。输出方案直接选所在强连通分量编号小的点。Code:#include<bits/stdc++.h>#define maxn 100005#define maxm 200005#define ID(i,j) ((原创 2020-06-01 18:44:38 · 154 阅读 · 0 评论 -
【2-sat】 POJ3648 Wedding
WeddingUp to thirty couples will attend a wedding feast, at which they will be seated on either side of a long table. The bride and groom sit at one end, opposite each other, and the bride wears an ...原创 2018-09-09 15:58:42 · 320 阅读 · 0 评论 -
2-sat学习笔记
例:struct TwoSAT{ int n; vector<int> G[N*2]; bool mark[N*2]; int S[N*2],c; int dfs(int x) { if (mark[x^1]) return 0; if (mark[x]) return 1; //和假设的值...原创 2020-01-21 20:22:35 · 187 阅读 · 0 评论