当前位置: 首页 > news >正文

旅游网站开发公司建设部网站官网 取消八大员

旅游网站开发公司,建设部网站官网 取消八大员,佛山快速排名优化,微商城开发费用多少题目链接#xff1a; 题目 建图#xff1a; 1.新娘向新郎连边#xff0c;表示选取的时候选取新娘对面的。 2. 有奸情的人比如是 xh yh那么连边(x,yn)以及(y,xn) 如果是xh yw 那么连边(x,y) 以及 (yn,x) 如果是xw yh 那么连边(xn,yn)以及(y,x) 如果是xw yw那么连边(x…题目链接 题目 建图 1.新娘向新郎连边表示选取的时候选取新娘对面的。 2. 有奸情的人比如是 xh yh那么连边(x,yn)以及(y,xn) 如果是xh yw 那么连边(x,y) 以及 (yn,x) 如果是xw yh 那么连边(xn,yn)以及(y,x) 如果是xw yw那么连边(xn,y)以及(y,xn) 其中  (x表示丈夫 x n xn表示妻子) 3.跑2-sat输出的时候注意输出新娘一边的。 因为我们选取的时候是按照新郎一边的选择的所以说输出的时候要取反再输出。 代码 #include vector #include cstring #include cstdio #include queue using namespace std; const int maxn 1000; int head[maxn]; int DFN[maxn],LOW[maxn],stk[maxn],visit[maxn],belong[maxn]; vectorint scc[maxn]; int tot,idx,cnt,sccnum; int n,color[maxn],degree[maxn],pos[maxn]; struct Es{ int v; int next; int cost; }Es[maxn1]; vectorint bkG[maxn]; void init(){ sccnum tot idx cnt 0; memset(head,-1,sizeof(head)); memset(DFN,0,sizeof(DFN)); memset(LOW,0,sizeof(LOW)); memset(visit,0,sizeof(visit)); memset(color,0,sizeof(color)); memset(degree,0,sizeof(degree));memset(pos,0,sizeof(pos));for(int i 0;i maxn;i) scc[i].clear();for(int i 0;i maxn;i) bkG[i].clear(); } inline void add_edge(int i,int j,int cost 1){ Es[cnt].v j; Es[cnt].cost cost; Es[cnt].next head[i]; head[i] cnt; } void tarjan(int x) {DFN[x]LOW[x]tot;stk[idx]x;visit[x]1;for(int ihead[x];i!-1;iEs[i].next){if(!DFN[Es[i].v]) {tarjan(Es[i].v);LOW[x] min(LOW[x],LOW[Es[i].v]);}else if(visit[Es[i].v ]){ LOW[x] min(LOW[x],DFN[Es[i].v]);}}if(LOW[x]DFN[x]){sccnum;do{int item stk[idx];belong[item] sccnum;scc[sccnum].push_back(item);visit[item]0;idx--;}while(x!stk[idx1]);}return ; } bool check(){for(int i 1;i n;i){if(belong[i] belong[in]) return false;}return true; } bool solve(){for(int i 1;i 2*n;i )if(!DFN[i]) tarjan(i);if(!check()) return false;for(int i 1;i n;i){if(!pos[belong[i]]){pos[belong[i]] belong[in];pos[belong[in]] belong[i];}}for(int i 1;i 2*n;i){for(int e head[i];e ! -1;e Es[e].next){int v Es[e].v;if(belong[i] ! belong[v]){degree[belong[i]];bkG[belong[v]].push_back(belong[i]);}}}queueint que;for(int i 1;i sccnum;i){if(!degree[i])que.push(i);}while(!que.empty()){int u que.front();que.pop();if(!color[u]){color[u] 1;color[pos[u]] 2;}for(int i 0;i bkG[u].size();i){int v bkG[u][i];degree[v]--;if(!degree[v])que.push(v);}}//在这里准备输出答案//为1表示选中为2表示为选中/*for(int i 1;i n;i){if(color[belong[i]] 1) {//Yes}else{//No}} */return true; } int main(){int m;while(~scanf(%d%d,n,m) n m){init();//n--;for(int i 0;i m;i){int a 0,b 0;char ta,tb;scanf(%d%c%d%c,a,ta,b,tb);a;b;add_edge(ta h?a:an,tb h?bn:b);add_edge(tb h?b:bn,ta h?an:a);}add_edge(n1,1);if(solve()){for(int i 2;i n;i){if(color[belong[i]] 1){printf(%d%c ,i-1,w);}else{printf(%d%c ,i-1,h);}}puts();}else{puts(bad luck);}}} /* 3 2 1w 2w 1w 2h*/
http://www.huolong8.cn/news/24090/

相关文章:

  • 手机网站建设经典教程做网站 斗地主
  • 伊利网站建设水平评价本人承接网站建设
  • 免费数据分析网站网页设计模板设计
  • 个人网站 组建用asp做网站题目
  • 美食分享网站建设策划书哪里做网站比较好
  • 主机屋做网站视频潍坊网站建设策划
  • 摄影网站建设自适应网站建站价格
  • 厦门有设计网站的吗管理系统论文
  • 企业网站建设公司丰台商业网站开发需求
  • 做网站需要多wordpress固定连接打不开
  • 上海企业建站提供商自己的网站统计输入词
  • 久商推网站建设grimhelm wordpress
  • 表格如何给网站做链接php做网站登陆验证
  • 广东源江建设集团有限公司网站php网页设计代码
  • 云龙网站开发wordpress如何给指定位置添加代码
  • asp网站做搜索免费seo工具
  • 利用免费网站做SEO网站建设多久学会
  • 网站 字体郑州网站建设zhuotop
  • 免费建立教育网站建立网站怎么赚钱
  • 北京做vr网站火车头采集网站
  • wordpres做影视网站企业宣传图片模板
  • 黄浦企业网站制作财务办公室装修设计
  • 重庆做企业网站设计的公司甘肃省酒泉市做网站公司
  • 电话约建设网站 客户民治营销型网站制作
  • 具有设计感的网站做网站用什么后台
  • 加强网站硬件建设方案在wordpress中设置mx记录
  • 别人在百度冒用公司旗号做网站赣州网站建设渠道
  • 夺宝网站开发简体中文wordpress5.2下载
  • 做断桥铝最知名的网站微网站栏目
  • 招远做网站阿里云虚拟主机可以做几个网站