国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

??透傎愵}目講解_Two Graphs( unordered_map)

2022-04-28 16:18 作者:Clayton_Zhou  | 我要投稿

// https://ac.nowcoder.com/acm/contest/20322/D

#include "stdafx.h"

//#include <bits/stdc++.h>


#include <algorithm>

#include <iostream>

#include <cstring>

?#include <vector>

?#include <unordered_map>


using namespace std;

int n,m1,m2,ans;

int f[10];

int e1[10][10],e2[10][10];

?char edge[32][2]={

1 ,2,

1 ,3,

4 ,1,

4 ,2,

4, 3

};

?

int main(){

n=4,m1=2,m2=3;

? ?// while(std::cin>>n>>m1>>m2){

? ? ? ? memset(e1,0,sizeof(e1));

? ? ? ? memset(e2,0,sizeof(e2));

std::unordered_map<int,int>m;

? ? ? ? ans=0;

? ? ? ? for(int i=1,x,y;i<=m1;i++){

? ? ? ? ? ?// cin>>x>>y;

x=edge[i-1][0];

y=edge[i-1][1];

? ? ? ? ? ? e1[x][y]=e1[y][x]=1;

? ? ? ? }

? ? ? ? for(int i=1,x,y;i<=m2;i++){

? ? ? ? ? ?// cin>>x>>y;

x=edge[m1+i-1][0];

y=edge[m1+i-1][1];


? ? ? ? ? ? e2[x][y]=e2[y][x]=i;

? ? ? ? }


? ? ? ? for(int i=1;i<=n;i++)f[i]=i;


? ? ? ? do{

? ? ? ? ? ? int flag=1,v=0;

? ? ? ? ? ? for(int i=1;i<=n;i++){

? ? ? ? ? ? ? ? for(int j=1;j<=n;j++){

? ? ? ? ? ? ? ? ? ? if(e1[i][j]){

if(!e2[f[i]][f[j]]){flag=0;break;}

// cout<<endl<<"before? "<<v<<"? e2[f[i]][f[j]]=? "<<e2[f[i]][f[j]]<<endl;

? ? ? ? ? ? ? ? ? ? ? ? v|=1<<e2[f[i]][f[j]];

// cout<<"After? "<<v<<endl;

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? }

if(!flag)break;

? ? ? ? ? ? }

? ? ? ? ? ? if(flag&&m[v]==0){

ans++,m[v]=1;

cout<<v<<endl;

}

? ? ? ? }while(std::next_permutation(f+1,f+n+1));

? ? ? ? printf("%d\n",ans);

? ?// }

? ? return 0;

}


??透傎愵}目講解_Two Graphs( unordered_map)的評論 (共 條)

分享到微博請遵守國家法律
怀宁县| 安新县| 龙南县| 南京市| 汽车| 合肥市| 阿巴嘎旗| 化德县| 阿拉尔市| 巩义市| 长春市| 板桥市| 蛟河市| 临澧县| 泸西县| 吴江市| 黄陵县| 临朐县| 安仁县| 清涧县| 万源市| 伽师县| 军事| 佛山市| 灌阳县| 定日县| 淮安市| 本溪市| 大兴区| 乌恰县| 无棣县| 灵石县| 麦盖提县| 丽水市| 通河县| 疏勒县| 防城港市| 台北县| 嘉兴市| 台江县| 贺兰县|