主頁 >  其他 > 淺談并查集

淺談并查集

2020-12-24 11:06:45 其他

并查集

概念:
并查集是一種資料結構
一般由兩個函式 F i n d ( ) Find( ) Find() U n i o n ( ) Union( ) Union()和陣列 f [ ] f[] f[]構成,
f [ ] f[] f[]用來記錄自己的
函式 f i n d ( x ) find(x) find(x)用于查找 x x x,函式 U n i o n ( x , y ) Union(x, y) Union(x,y)用于合并兩個集,

例子的引入 :)

背景:

在一個百家爭戰()的時代,存在非常多的家派,比如說:武當派, 少林派, 華山派······
因為當時時代極為不和平,所以不是屬于一個家派的人見到面就會干架(社會不良行為)
但是可能會遇到一些問題,(可能會誤傷隊友,
關系網如圖

<style>#mermaid-svg-2iEE2SwnuZp09aaX .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-2iEE2SwnuZp09aaX .label text{fill:#333}#mermaid-svg-2iEE2SwnuZp09aaX .node rect,#mermaid-svg-2iEE2SwnuZp09aaX .node circle,#mermaid-svg-2iEE2SwnuZp09aaX .node ellipse,#mermaid-svg-2iEE2SwnuZp09aaX .node polygon,#mermaid-svg-2iEE2SwnuZp09aaX .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-2iEE2SwnuZp09aaX .node .label{text-align:center;fill:#333}#mermaid-svg-2iEE2SwnuZp09aaX .node.clickable{cursor:pointer}#mermaid-svg-2iEE2SwnuZp09aaX .arrowheadPath{fill:#333}#mermaid-svg-2iEE2SwnuZp09aaX .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-2iEE2SwnuZp09aaX .flowchart-link{stroke:#333;fill:none}#mermaid-svg-2iEE2SwnuZp09aaX .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-2iEE2SwnuZp09aaX .edgeLabel rect{opacity:0.9}#mermaid-svg-2iEE2SwnuZp09aaX .edgeLabel span{color:#333}#mermaid-svg-2iEE2SwnuZp09aaX .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-2iEE2SwnuZp09aaX .cluster text{fill:#333}#mermaid-svg-2iEE2SwnuZp09aaX div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-2iEE2SwnuZp09aaX .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-2iEE2SwnuZp09aaX text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-2iEE2SwnuZp09aaX .actor-line{stroke:grey}#mermaid-svg-2iEE2SwnuZp09aaX .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-2iEE2SwnuZp09aaX .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-2iEE2SwnuZp09aaX #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-2iEE2SwnuZp09aaX .sequenceNumber{fill:#fff}#mermaid-svg-2iEE2SwnuZp09aaX #sequencenumber{fill:#333}#mermaid-svg-2iEE2SwnuZp09aaX #crosshead path{fill:#333;stroke:#333}#mermaid-svg-2iEE2SwnuZp09aaX .messageText{fill:#333;stroke:#333}#mermaid-svg-2iEE2SwnuZp09aaX .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-2iEE2SwnuZp09aaX .labelText,#mermaid-svg-2iEE2SwnuZp09aaX .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-2iEE2SwnuZp09aaX .loopText,#mermaid-svg-2iEE2SwnuZp09aaX .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-2iEE2SwnuZp09aaX .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-2iEE2SwnuZp09aaX .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-2iEE2SwnuZp09aaX .noteText,#mermaid-svg-2iEE2SwnuZp09aaX .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-2iEE2SwnuZp09aaX .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-2iEE2SwnuZp09aaX .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-2iEE2SwnuZp09aaX .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-2iEE2SwnuZp09aaX .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-2iEE2SwnuZp09aaX .section{stroke:none;opacity:0.2}#mermaid-svg-2iEE2SwnuZp09aaX .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-2iEE2SwnuZp09aaX .section2{fill:#fff400}#mermaid-svg-2iEE2SwnuZp09aaX .section1,#mermaid-svg-2iEE2SwnuZp09aaX .section3{fill:#fff;opacity:0.2}#mermaid-svg-2iEE2SwnuZp09aaX .sectionTitle0{fill:#333}#mermaid-svg-2iEE2SwnuZp09aaX .sectionTitle1{fill:#333}#mermaid-svg-2iEE2SwnuZp09aaX .sectionTitle2{fill:#333}#mermaid-svg-2iEE2SwnuZp09aaX .sectionTitle3{fill:#333}#mermaid-svg-2iEE2SwnuZp09aaX .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-2iEE2SwnuZp09aaX .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-2iEE2SwnuZp09aaX .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-2iEE2SwnuZp09aaX .grid path{stroke-width:0}#mermaid-svg-2iEE2SwnuZp09aaX .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-2iEE2SwnuZp09aaX .task{stroke-width:2}#mermaid-svg-2iEE2SwnuZp09aaX .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-2iEE2SwnuZp09aaX .taskText:not([font-size]){font-size:11px}#mermaid-svg-2iEE2SwnuZp09aaX .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-2iEE2SwnuZp09aaX .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-2iEE2SwnuZp09aaX .task.clickable{cursor:pointer}#mermaid-svg-2iEE2SwnuZp09aaX .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-2iEE2SwnuZp09aaX .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-2iEE2SwnuZp09aaX .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-2iEE2SwnuZp09aaX .taskText0,#mermaid-svg-2iEE2SwnuZp09aaX .taskText1,#mermaid-svg-2iEE2SwnuZp09aaX .taskText2,#mermaid-svg-2iEE2SwnuZp09aaX .taskText3{fill:#fff}#mermaid-svg-2iEE2SwnuZp09aaX .task0,#mermaid-svg-2iEE2SwnuZp09aaX .task1,#mermaid-svg-2iEE2SwnuZp09aaX .task2,#mermaid-svg-2iEE2SwnuZp09aaX .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-2iEE2SwnuZp09aaX .taskTextOutside0,#mermaid-svg-2iEE2SwnuZp09aaX .taskTextOutside2{fill:#000}#mermaid-svg-2iEE2SwnuZp09aaX .taskTextOutside1,#mermaid-svg-2iEE2SwnuZp09aaX .taskTextOutside3{fill:#000}#mermaid-svg-2iEE2SwnuZp09aaX .active0,#mermaid-svg-2iEE2SwnuZp09aaX .active1,#mermaid-svg-2iEE2SwnuZp09aaX .active2,#mermaid-svg-2iEE2SwnuZp09aaX .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-2iEE2SwnuZp09aaX .activeText0,#mermaid-svg-2iEE2SwnuZp09aaX .activeText1,#mermaid-svg-2iEE2SwnuZp09aaX .activeText2,#mermaid-svg-2iEE2SwnuZp09aaX .activeText3{fill:#000 !important}#mermaid-svg-2iEE2SwnuZp09aaX .done0,#mermaid-svg-2iEE2SwnuZp09aaX .done1,#mermaid-svg-2iEE2SwnuZp09aaX .done2,#mermaid-svg-2iEE2SwnuZp09aaX .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-2iEE2SwnuZp09aaX .doneText0,#mermaid-svg-2iEE2SwnuZp09aaX .doneText1,#mermaid-svg-2iEE2SwnuZp09aaX .doneText2,#mermaid-svg-2iEE2SwnuZp09aaX .doneText3{fill:#000 !important}#mermaid-svg-2iEE2SwnuZp09aaX .crit0,#mermaid-svg-2iEE2SwnuZp09aaX .crit1,#mermaid-svg-2iEE2SwnuZp09aaX .crit2,#mermaid-svg-2iEE2SwnuZp09aaX .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-2iEE2SwnuZp09aaX .activeCrit0,#mermaid-svg-2iEE2SwnuZp09aaX .activeCrit1,#mermaid-svg-2iEE2SwnuZp09aaX .activeCrit2,#mermaid-svg-2iEE2SwnuZp09aaX .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-2iEE2SwnuZp09aaX .doneCrit0,#mermaid-svg-2iEE2SwnuZp09aaX .doneCrit1,#mermaid-svg-2iEE2SwnuZp09aaX .doneCrit2,#mermaid-svg-2iEE2SwnuZp09aaX .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-2iEE2SwnuZp09aaX .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-2iEE2SwnuZp09aaX .milestoneText{font-style:italic}#mermaid-svg-2iEE2SwnuZp09aaX .doneCritText0,#mermaid-svg-2iEE2SwnuZp09aaX .doneCritText1,#mermaid-svg-2iEE2SwnuZp09aaX .doneCritText2,#mermaid-svg-2iEE2SwnuZp09aaX .doneCritText3{fill:#000 !important}#mermaid-svg-2iEE2SwnuZp09aaX .activeCritText0,#mermaid-svg-2iEE2SwnuZp09aaX .activeCritText1,#mermaid-svg-2iEE2SwnuZp09aaX .activeCritText2,#mermaid-svg-2iEE2SwnuZp09aaX .activeCritText3{fill:#000 !important}#mermaid-svg-2iEE2SwnuZp09aaX .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-2iEE2SwnuZp09aaX g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-2iEE2SwnuZp09aaX g.classGroup text .title{font-weight:bolder}#mermaid-svg-2iEE2SwnuZp09aaX g.clickable{cursor:pointer}#mermaid-svg-2iEE2SwnuZp09aaX g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-2iEE2SwnuZp09aaX g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-2iEE2SwnuZp09aaX .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-2iEE2SwnuZp09aaX .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-2iEE2SwnuZp09aaX .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-2iEE2SwnuZp09aaX .dashed-line{stroke-dasharray:3}#mermaid-svg-2iEE2SwnuZp09aaX #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-2iEE2SwnuZp09aaX #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-2iEE2SwnuZp09aaX #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-2iEE2SwnuZp09aaX #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-2iEE2SwnuZp09aaX #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-2iEE2SwnuZp09aaX #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-2iEE2SwnuZp09aaX #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-2iEE2SwnuZp09aaX #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-2iEE2SwnuZp09aaX .commit-id,#mermaid-svg-2iEE2SwnuZp09aaX .commit-msg,#mermaid-svg-2iEE2SwnuZp09aaX .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-2iEE2SwnuZp09aaX .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-2iEE2SwnuZp09aaX .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-2iEE2SwnuZp09aaX g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-2iEE2SwnuZp09aaX g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-2iEE2SwnuZp09aaX g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-2iEE2SwnuZp09aaX g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-2iEE2SwnuZp09aaX g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-2iEE2SwnuZp09aaX g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-2iEE2SwnuZp09aaX .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-2iEE2SwnuZp09aaX .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-2iEE2SwnuZp09aaX .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-2iEE2SwnuZp09aaX .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-2iEE2SwnuZp09aaX .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-2iEE2SwnuZp09aaX .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-2iEE2SwnuZp09aaX .edgeLabel text{fill:#333}#mermaid-svg-2iEE2SwnuZp09aaX .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-2iEE2SwnuZp09aaX .node circle.state-start{fill:black;stroke:black}#mermaid-svg-2iEE2SwnuZp09aaX .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-2iEE2SwnuZp09aaX #statediagram-barbEnd{fill:#9370db}#mermaid-svg-2iEE2SwnuZp09aaX .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-2iEE2SwnuZp09aaX .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-2iEE2SwnuZp09aaX .statediagram-state .divider{stroke:#9370db}#mermaid-svg-2iEE2SwnuZp09aaX .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-2iEE2SwnuZp09aaX .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-2iEE2SwnuZp09aaX .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-2iEE2SwnuZp09aaX .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-2iEE2SwnuZp09aaX .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-2iEE2SwnuZp09aaX .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-2iEE2SwnuZp09aaX .note-edge{stroke-dasharray:5}#mermaid-svg-2iEE2SwnuZp09aaX .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-2iEE2SwnuZp09aaX .error-icon{fill:#522}#mermaid-svg-2iEE2SwnuZp09aaX .error-text{fill:#522;stroke:#522}#mermaid-svg-2iEE2SwnuZp09aaX .edge-thickness-normal{stroke-width:2px}#mermaid-svg-2iEE2SwnuZp09aaX .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-2iEE2SwnuZp09aaX .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-2iEE2SwnuZp09aaX .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-2iEE2SwnuZp09aaX .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-2iEE2SwnuZp09aaX .marker{fill:#333}#mermaid-svg-2iEE2SwnuZp09aaX .marker.cross{stroke:#333} :root { --mermaid-font-family: "trebuchet ms", verdana, arial;}</style> <style>#mermaid-svg-2iEE2SwnuZp09aaX { color: rgba(0, 0, 0, 0.75); font: ; }</style>
武當派
李淵鳴
張三豐
沖虛道長
宋青書
愚茶道長
張無忌
馬真
陸菲青
少林派
達摩祖師
玄苦
掃地僧
玄渡
玄慈
玄寂
玄悲
玄痛
華山派
郝大通
高老者
莫逆
薛仁豪
風清揚
矮老者
白仁甫
黃真
劉培生

關系好復雜·······
這個時候,就可以用并查集來儲存關系,
Such as:馬真的師傅是沖虛道長,沖虛道長的師傅是張三豐,··········

F i n d ( ) Find() Find()函式的引入

馬真遇到陸菲青
馬真問道:“敢問閣下可否與鄙人一戰?”
陸菲青反問:“敢問閣下是哪個家派的?鄙人所屬武當派,”
為了防止發生誤傷,
馬真使用了 F i n d ( ) Find( ) Find()函式, 來查詢自己的

inline int Find(int x) {				//查找x的家派
	while(f[x] != x)			//如果x的師父是x自己, 那么自己就是家派
		x = f[x];				//x接著找他的上級,直到找到家派為止
	return x;					//家派駕到~~~
}

但是······,馬真–>沖虛道長–>張三豐–>武當派,問的人也太多了,而且時間也挺慢的···
說不定還沒問到,已經打完了
于是,便出現了一種更為快捷的 F i n d ( ) Find() Find()函式,名為 路徑壓縮

inline int Find(int x) {  //inline進行優化
	if (f[x] == x) return x;    //如果x的師傅是x自己
	else return f[x] = find(f[x]);  //如果不是,那么繼續自己的師傅
}

經過了路徑壓縮, 關系的儲存就會變成以下形式:

<style>#mermaid-svg-dQaTpNLpKGHIHlcx .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-dQaTpNLpKGHIHlcx .label text{fill:#333}#mermaid-svg-dQaTpNLpKGHIHlcx .node rect,#mermaid-svg-dQaTpNLpKGHIHlcx .node circle,#mermaid-svg-dQaTpNLpKGHIHlcx .node ellipse,#mermaid-svg-dQaTpNLpKGHIHlcx .node polygon,#mermaid-svg-dQaTpNLpKGHIHlcx .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-dQaTpNLpKGHIHlcx .node .label{text-align:center;fill:#333}#mermaid-svg-dQaTpNLpKGHIHlcx .node.clickable{cursor:pointer}#mermaid-svg-dQaTpNLpKGHIHlcx .arrowheadPath{fill:#333}#mermaid-svg-dQaTpNLpKGHIHlcx .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-dQaTpNLpKGHIHlcx .flowchart-link{stroke:#333;fill:none}#mermaid-svg-dQaTpNLpKGHIHlcx .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-dQaTpNLpKGHIHlcx .edgeLabel rect{opacity:0.9}#mermaid-svg-dQaTpNLpKGHIHlcx .edgeLabel span{color:#333}#mermaid-svg-dQaTpNLpKGHIHlcx .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-dQaTpNLpKGHIHlcx .cluster text{fill:#333}#mermaid-svg-dQaTpNLpKGHIHlcx div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-dQaTpNLpKGHIHlcx .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-dQaTpNLpKGHIHlcx text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-dQaTpNLpKGHIHlcx .actor-line{stroke:grey}#mermaid-svg-dQaTpNLpKGHIHlcx .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-dQaTpNLpKGHIHlcx .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-dQaTpNLpKGHIHlcx #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-dQaTpNLpKGHIHlcx .sequenceNumber{fill:#fff}#mermaid-svg-dQaTpNLpKGHIHlcx #sequencenumber{fill:#333}#mermaid-svg-dQaTpNLpKGHIHlcx #crosshead path{fill:#333;stroke:#333}#mermaid-svg-dQaTpNLpKGHIHlcx .messageText{fill:#333;stroke:#333}#mermaid-svg-dQaTpNLpKGHIHlcx .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-dQaTpNLpKGHIHlcx .labelText,#mermaid-svg-dQaTpNLpKGHIHlcx .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-dQaTpNLpKGHIHlcx .loopText,#mermaid-svg-dQaTpNLpKGHIHlcx .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-dQaTpNLpKGHIHlcx .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-dQaTpNLpKGHIHlcx .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-dQaTpNLpKGHIHlcx .noteText,#mermaid-svg-dQaTpNLpKGHIHlcx .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-dQaTpNLpKGHIHlcx .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-dQaTpNLpKGHIHlcx .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-dQaTpNLpKGHIHlcx .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-dQaTpNLpKGHIHlcx .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-dQaTpNLpKGHIHlcx .section{stroke:none;opacity:0.2}#mermaid-svg-dQaTpNLpKGHIHlcx .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-dQaTpNLpKGHIHlcx .section2{fill:#fff400}#mermaid-svg-dQaTpNLpKGHIHlcx .section1,#mermaid-svg-dQaTpNLpKGHIHlcx .section3{fill:#fff;opacity:0.2}#mermaid-svg-dQaTpNLpKGHIHlcx .sectionTitle0{fill:#333}#mermaid-svg-dQaTpNLpKGHIHlcx .sectionTitle1{fill:#333}#mermaid-svg-dQaTpNLpKGHIHlcx .sectionTitle2{fill:#333}#mermaid-svg-dQaTpNLpKGHIHlcx .sectionTitle3{fill:#333}#mermaid-svg-dQaTpNLpKGHIHlcx .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-dQaTpNLpKGHIHlcx .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-dQaTpNLpKGHIHlcx .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-dQaTpNLpKGHIHlcx .grid path{stroke-width:0}#mermaid-svg-dQaTpNLpKGHIHlcx .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-dQaTpNLpKGHIHlcx .task{stroke-width:2}#mermaid-svg-dQaTpNLpKGHIHlcx .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-dQaTpNLpKGHIHlcx .taskText:not([font-size]){font-size:11px}#mermaid-svg-dQaTpNLpKGHIHlcx .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-dQaTpNLpKGHIHlcx .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-dQaTpNLpKGHIHlcx .task.clickable{cursor:pointer}#mermaid-svg-dQaTpNLpKGHIHlcx .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-dQaTpNLpKGHIHlcx .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-dQaTpNLpKGHIHlcx .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-dQaTpNLpKGHIHlcx .taskText0,#mermaid-svg-dQaTpNLpKGHIHlcx .taskText1,#mermaid-svg-dQaTpNLpKGHIHlcx .taskText2,#mermaid-svg-dQaTpNLpKGHIHlcx .taskText3{fill:#fff}#mermaid-svg-dQaTpNLpKGHIHlcx .task0,#mermaid-svg-dQaTpNLpKGHIHlcx .task1,#mermaid-svg-dQaTpNLpKGHIHlcx .task2,#mermaid-svg-dQaTpNLpKGHIHlcx .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-dQaTpNLpKGHIHlcx .taskTextOutside0,#mermaid-svg-dQaTpNLpKGHIHlcx .taskTextOutside2{fill:#000}#mermaid-svg-dQaTpNLpKGHIHlcx .taskTextOutside1,#mermaid-svg-dQaTpNLpKGHIHlcx .taskTextOutside3{fill:#000}#mermaid-svg-dQaTpNLpKGHIHlcx .active0,#mermaid-svg-dQaTpNLpKGHIHlcx .active1,#mermaid-svg-dQaTpNLpKGHIHlcx .active2,#mermaid-svg-dQaTpNLpKGHIHlcx .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-dQaTpNLpKGHIHlcx .activeText0,#mermaid-svg-dQaTpNLpKGHIHlcx .activeText1,#mermaid-svg-dQaTpNLpKGHIHlcx .activeText2,#mermaid-svg-dQaTpNLpKGHIHlcx .activeText3{fill:#000 !important}#mermaid-svg-dQaTpNLpKGHIHlcx .done0,#mermaid-svg-dQaTpNLpKGHIHlcx .done1,#mermaid-svg-dQaTpNLpKGHIHlcx .done2,#mermaid-svg-dQaTpNLpKGHIHlcx .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-dQaTpNLpKGHIHlcx .doneText0,#mermaid-svg-dQaTpNLpKGHIHlcx .doneText1,#mermaid-svg-dQaTpNLpKGHIHlcx .doneText2,#mermaid-svg-dQaTpNLpKGHIHlcx .doneText3{fill:#000 !important}#mermaid-svg-dQaTpNLpKGHIHlcx .crit0,#mermaid-svg-dQaTpNLpKGHIHlcx .crit1,#mermaid-svg-dQaTpNLpKGHIHlcx .crit2,#mermaid-svg-dQaTpNLpKGHIHlcx .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-dQaTpNLpKGHIHlcx .activeCrit0,#mermaid-svg-dQaTpNLpKGHIHlcx .activeCrit1,#mermaid-svg-dQaTpNLpKGHIHlcx .activeCrit2,#mermaid-svg-dQaTpNLpKGHIHlcx .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-dQaTpNLpKGHIHlcx .doneCrit0,#mermaid-svg-dQaTpNLpKGHIHlcx .doneCrit1,#mermaid-svg-dQaTpNLpKGHIHlcx .doneCrit2,#mermaid-svg-dQaTpNLpKGHIHlcx .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-dQaTpNLpKGHIHlcx .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-dQaTpNLpKGHIHlcx .milestoneText{font-style:italic}#mermaid-svg-dQaTpNLpKGHIHlcx .doneCritText0,#mermaid-svg-dQaTpNLpKGHIHlcx .doneCritText1,#mermaid-svg-dQaTpNLpKGHIHlcx .doneCritText2,#mermaid-svg-dQaTpNLpKGHIHlcx .doneCritText3{fill:#000 !important}#mermaid-svg-dQaTpNLpKGHIHlcx .activeCritText0,#mermaid-svg-dQaTpNLpKGHIHlcx .activeCritText1,#mermaid-svg-dQaTpNLpKGHIHlcx .activeCritText2,#mermaid-svg-dQaTpNLpKGHIHlcx .activeCritText3{fill:#000 !important}#mermaid-svg-dQaTpNLpKGHIHlcx .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-dQaTpNLpKGHIHlcx g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-dQaTpNLpKGHIHlcx g.classGroup text .title{font-weight:bolder}#mermaid-svg-dQaTpNLpKGHIHlcx g.clickable{cursor:pointer}#mermaid-svg-dQaTpNLpKGHIHlcx g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-dQaTpNLpKGHIHlcx g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-dQaTpNLpKGHIHlcx .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-dQaTpNLpKGHIHlcx .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-dQaTpNLpKGHIHlcx .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-dQaTpNLpKGHIHlcx .dashed-line{stroke-dasharray:3}#mermaid-svg-dQaTpNLpKGHIHlcx #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-dQaTpNLpKGHIHlcx #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-dQaTpNLpKGHIHlcx #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-dQaTpNLpKGHIHlcx #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-dQaTpNLpKGHIHlcx #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-dQaTpNLpKGHIHlcx #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-dQaTpNLpKGHIHlcx #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-dQaTpNLpKGHIHlcx #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-dQaTpNLpKGHIHlcx .commit-id,#mermaid-svg-dQaTpNLpKGHIHlcx .commit-msg,#mermaid-svg-dQaTpNLpKGHIHlcx .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-dQaTpNLpKGHIHlcx .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-dQaTpNLpKGHIHlcx .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-dQaTpNLpKGHIHlcx g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-dQaTpNLpKGHIHlcx g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-dQaTpNLpKGHIHlcx g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-dQaTpNLpKGHIHlcx g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-dQaTpNLpKGHIHlcx g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-dQaTpNLpKGHIHlcx g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-dQaTpNLpKGHIHlcx .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-dQaTpNLpKGHIHlcx .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-dQaTpNLpKGHIHlcx .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-dQaTpNLpKGHIHlcx .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-dQaTpNLpKGHIHlcx .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-dQaTpNLpKGHIHlcx .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-dQaTpNLpKGHIHlcx .edgeLabel text{fill:#333}#mermaid-svg-dQaTpNLpKGHIHlcx .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-dQaTpNLpKGHIHlcx .node circle.state-start{fill:black;stroke:black}#mermaid-svg-dQaTpNLpKGHIHlcx .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-dQaTpNLpKGHIHlcx #statediagram-barbEnd{fill:#9370db}#mermaid-svg-dQaTpNLpKGHIHlcx .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-dQaTpNLpKGHIHlcx .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-dQaTpNLpKGHIHlcx .statediagram-state .divider{stroke:#9370db}#mermaid-svg-dQaTpNLpKGHIHlcx .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-dQaTpNLpKGHIHlcx .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-dQaTpNLpKGHIHlcx .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-dQaTpNLpKGHIHlcx .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-dQaTpNLpKGHIHlcx .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-dQaTpNLpKGHIHlcx .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-dQaTpNLpKGHIHlcx .note-edge{stroke-dasharray:5}#mermaid-svg-dQaTpNLpKGHIHlcx .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-dQaTpNLpKGHIHlcx .error-icon{fill:#522}#mermaid-svg-dQaTpNLpKGHIHlcx .error-text{fill:#522;stroke:#522}#mermaid-svg-dQaTpNLpKGHIHlcx .edge-thickness-normal{stroke-width:2px}#mermaid-svg-dQaTpNLpKGHIHlcx .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-dQaTpNLpKGHIHlcx .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-dQaTpNLpKGHIHlcx .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-dQaTpNLpKGHIHlcx .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-dQaTpNLpKGHIHlcx .marker{fill:#333}#mermaid-svg-dQaTpNLpKGHIHlcx .marker.cross{stroke:#333} :root { --mermaid-font-family: "trebuchet ms", verdana, arial;}</style> <style>#mermaid-svg-dQaTpNLpKGHIHlcx { color: rgba(0, 0, 0, 0.75); font: ; }</style>
武當派
李淵鳴
張三豐
沖虛道長
宋青書
愚茶道長
張無忌
馬真
陸菲青
...
...

可以直接找到自己所屬家派,避免誤傷,挺好的,

U n i o n ( ) Union() Union()函式的引入

亂世之下,華山派部分弟子的關系變的愈發惡劣,經常出現矛盾,
終于,弟子風清揚忍無可忍,
U n i o n ( ) Union() Union()投靠了武當派,
于是關系:

<style>#mermaid-svg-7diiMHQMsjiWrCQ1 .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 .label text{fill:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 .node rect,#mermaid-svg-7diiMHQMsjiWrCQ1 .node circle,#mermaid-svg-7diiMHQMsjiWrCQ1 .node ellipse,#mermaid-svg-7diiMHQMsjiWrCQ1 .node polygon,#mermaid-svg-7diiMHQMsjiWrCQ1 .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-7diiMHQMsjiWrCQ1 .node .label{text-align:center;fill:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 .node.clickable{cursor:pointer}#mermaid-svg-7diiMHQMsjiWrCQ1 .arrowheadPath{fill:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-7diiMHQMsjiWrCQ1 .flowchart-link{stroke:#333;fill:none}#mermaid-svg-7diiMHQMsjiWrCQ1 .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-7diiMHQMsjiWrCQ1 .edgeLabel rect{opacity:0.9}#mermaid-svg-7diiMHQMsjiWrCQ1 .edgeLabel span{color:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-7diiMHQMsjiWrCQ1 .cluster text{fill:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-7diiMHQMsjiWrCQ1 .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-7diiMHQMsjiWrCQ1 text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-7diiMHQMsjiWrCQ1 .actor-line{stroke:grey}#mermaid-svg-7diiMHQMsjiWrCQ1 .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 .sequenceNumber{fill:#fff}#mermaid-svg-7diiMHQMsjiWrCQ1 #sequencenumber{fill:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 #crosshead path{fill:#333;stroke:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 .messageText{fill:#333;stroke:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-7diiMHQMsjiWrCQ1 .labelText,#mermaid-svg-7diiMHQMsjiWrCQ1 .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-7diiMHQMsjiWrCQ1 .loopText,#mermaid-svg-7diiMHQMsjiWrCQ1 .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-7diiMHQMsjiWrCQ1 .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-7diiMHQMsjiWrCQ1 .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-7diiMHQMsjiWrCQ1 .noteText,#mermaid-svg-7diiMHQMsjiWrCQ1 .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-7diiMHQMsjiWrCQ1 .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-7diiMHQMsjiWrCQ1 .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-7diiMHQMsjiWrCQ1 .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-7diiMHQMsjiWrCQ1 .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-7diiMHQMsjiWrCQ1 .section{stroke:none;opacity:0.2}#mermaid-svg-7diiMHQMsjiWrCQ1 .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-7diiMHQMsjiWrCQ1 .section2{fill:#fff400}#mermaid-svg-7diiMHQMsjiWrCQ1 .section1,#mermaid-svg-7diiMHQMsjiWrCQ1 .section3{fill:#fff;opacity:0.2}#mermaid-svg-7diiMHQMsjiWrCQ1 .sectionTitle0{fill:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 .sectionTitle1{fill:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 .sectionTitle2{fill:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 .sectionTitle3{fill:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-7diiMHQMsjiWrCQ1 .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-7diiMHQMsjiWrCQ1 .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-7diiMHQMsjiWrCQ1 .grid path{stroke-width:0}#mermaid-svg-7diiMHQMsjiWrCQ1 .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-7diiMHQMsjiWrCQ1 .task{stroke-width:2}#mermaid-svg-7diiMHQMsjiWrCQ1 .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-7diiMHQMsjiWrCQ1 .taskText:not([font-size]){font-size:11px}#mermaid-svg-7diiMHQMsjiWrCQ1 .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-7diiMHQMsjiWrCQ1 .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-7diiMHQMsjiWrCQ1 .task.clickable{cursor:pointer}#mermaid-svg-7diiMHQMsjiWrCQ1 .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-7diiMHQMsjiWrCQ1 .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-7diiMHQMsjiWrCQ1 .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-7diiMHQMsjiWrCQ1 .taskText0,#mermaid-svg-7diiMHQMsjiWrCQ1 .taskText1,#mermaid-svg-7diiMHQMsjiWrCQ1 .taskText2,#mermaid-svg-7diiMHQMsjiWrCQ1 .taskText3{fill:#fff}#mermaid-svg-7diiMHQMsjiWrCQ1 .task0,#mermaid-svg-7diiMHQMsjiWrCQ1 .task1,#mermaid-svg-7diiMHQMsjiWrCQ1 .task2,#mermaid-svg-7diiMHQMsjiWrCQ1 .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-7diiMHQMsjiWrCQ1 .taskTextOutside0,#mermaid-svg-7diiMHQMsjiWrCQ1 .taskTextOutside2{fill:#000}#mermaid-svg-7diiMHQMsjiWrCQ1 .taskTextOutside1,#mermaid-svg-7diiMHQMsjiWrCQ1 .taskTextOutside3{fill:#000}#mermaid-svg-7diiMHQMsjiWrCQ1 .active0,#mermaid-svg-7diiMHQMsjiWrCQ1 .active1,#mermaid-svg-7diiMHQMsjiWrCQ1 .active2,#mermaid-svg-7diiMHQMsjiWrCQ1 .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-7diiMHQMsjiWrCQ1 .activeText0,#mermaid-svg-7diiMHQMsjiWrCQ1 .activeText1,#mermaid-svg-7diiMHQMsjiWrCQ1 .activeText2,#mermaid-svg-7diiMHQMsjiWrCQ1 .activeText3{fill:#000 !important}#mermaid-svg-7diiMHQMsjiWrCQ1 .done0,#mermaid-svg-7diiMHQMsjiWrCQ1 .done1,#mermaid-svg-7diiMHQMsjiWrCQ1 .done2,#mermaid-svg-7diiMHQMsjiWrCQ1 .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-7diiMHQMsjiWrCQ1 .doneText0,#mermaid-svg-7diiMHQMsjiWrCQ1 .doneText1,#mermaid-svg-7diiMHQMsjiWrCQ1 .doneText2,#mermaid-svg-7diiMHQMsjiWrCQ1 .doneText3{fill:#000 !important}#mermaid-svg-7diiMHQMsjiWrCQ1 .crit0,#mermaid-svg-7diiMHQMsjiWrCQ1 .crit1,#mermaid-svg-7diiMHQMsjiWrCQ1 .crit2,#mermaid-svg-7diiMHQMsjiWrCQ1 .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-7diiMHQMsjiWrCQ1 .activeCrit0,#mermaid-svg-7diiMHQMsjiWrCQ1 .activeCrit1,#mermaid-svg-7diiMHQMsjiWrCQ1 .activeCrit2,#mermaid-svg-7diiMHQMsjiWrCQ1 .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-7diiMHQMsjiWrCQ1 .doneCrit0,#mermaid-svg-7diiMHQMsjiWrCQ1 .doneCrit1,#mermaid-svg-7diiMHQMsjiWrCQ1 .doneCrit2,#mermaid-svg-7diiMHQMsjiWrCQ1 .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-7diiMHQMsjiWrCQ1 .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-7diiMHQMsjiWrCQ1 .milestoneText{font-style:italic}#mermaid-svg-7diiMHQMsjiWrCQ1 .doneCritText0,#mermaid-svg-7diiMHQMsjiWrCQ1 .doneCritText1,#mermaid-svg-7diiMHQMsjiWrCQ1 .doneCritText2,#mermaid-svg-7diiMHQMsjiWrCQ1 .doneCritText3{fill:#000 !important}#mermaid-svg-7diiMHQMsjiWrCQ1 .activeCritText0,#mermaid-svg-7diiMHQMsjiWrCQ1 .activeCritText1,#mermaid-svg-7diiMHQMsjiWrCQ1 .activeCritText2,#mermaid-svg-7diiMHQMsjiWrCQ1 .activeCritText3{fill:#000 !important}#mermaid-svg-7diiMHQMsjiWrCQ1 .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-7diiMHQMsjiWrCQ1 g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-7diiMHQMsjiWrCQ1 g.classGroup text .title{font-weight:bolder}#mermaid-svg-7diiMHQMsjiWrCQ1 g.clickable{cursor:pointer}#mermaid-svg-7diiMHQMsjiWrCQ1 g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-7diiMHQMsjiWrCQ1 g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-7diiMHQMsjiWrCQ1 .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-7diiMHQMsjiWrCQ1 .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-7diiMHQMsjiWrCQ1 .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-7diiMHQMsjiWrCQ1 .dashed-line{stroke-dasharray:3}#mermaid-svg-7diiMHQMsjiWrCQ1 #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-7diiMHQMsjiWrCQ1 #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-7diiMHQMsjiWrCQ1 #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-7diiMHQMsjiWrCQ1 #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-7diiMHQMsjiWrCQ1 #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-7diiMHQMsjiWrCQ1 #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-7diiMHQMsjiWrCQ1 #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-7diiMHQMsjiWrCQ1 #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-7diiMHQMsjiWrCQ1 .commit-id,#mermaid-svg-7diiMHQMsjiWrCQ1 .commit-msg,#mermaid-svg-7diiMHQMsjiWrCQ1 .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-7diiMHQMsjiWrCQ1 .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-7diiMHQMsjiWrCQ1 .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-7diiMHQMsjiWrCQ1 g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-7diiMHQMsjiWrCQ1 g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-7diiMHQMsjiWrCQ1 g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-7diiMHQMsjiWrCQ1 g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-7diiMHQMsjiWrCQ1 g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-7diiMHQMsjiWrCQ1 .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-7diiMHQMsjiWrCQ1 .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-7diiMHQMsjiWrCQ1 .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-7diiMHQMsjiWrCQ1 .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-7diiMHQMsjiWrCQ1 .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-7diiMHQMsjiWrCQ1 .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-7diiMHQMsjiWrCQ1 .edgeLabel text{fill:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-7diiMHQMsjiWrCQ1 .node circle.state-start{fill:black;stroke:black}#mermaid-svg-7diiMHQMsjiWrCQ1 .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-7diiMHQMsjiWrCQ1 #statediagram-barbEnd{fill:#9370db}#mermaid-svg-7diiMHQMsjiWrCQ1 .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-7diiMHQMsjiWrCQ1 .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-7diiMHQMsjiWrCQ1 .statediagram-state .divider{stroke:#9370db}#mermaid-svg-7diiMHQMsjiWrCQ1 .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-7diiMHQMsjiWrCQ1 .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-7diiMHQMsjiWrCQ1 .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-7diiMHQMsjiWrCQ1 .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-7diiMHQMsjiWrCQ1 .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-7diiMHQMsjiWrCQ1 .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-7diiMHQMsjiWrCQ1 .note-edge{stroke-dasharray:5}#mermaid-svg-7diiMHQMsjiWrCQ1 .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-7diiMHQMsjiWrCQ1 .error-icon{fill:#522}#mermaid-svg-7diiMHQMsjiWrCQ1 .error-text{fill:#522;stroke:#522}#mermaid-svg-7diiMHQMsjiWrCQ1 .edge-thickness-normal{stroke-width:2px}#mermaid-svg-7diiMHQMsjiWrCQ1 .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-7diiMHQMsjiWrCQ1 .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-7diiMHQMsjiWrCQ1 .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-7diiMHQMsjiWrCQ1 .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-7diiMHQMsjiWrCQ1 .marker{fill:#333}#mermaid-svg-7diiMHQMsjiWrCQ1 .marker.cross{stroke:#333} :root { --mermaid-font-family: "trebuchet ms", verdana, arial;}</style> <style>#mermaid-svg-7diiMHQMsjiWrCQ1 { color: rgba(0, 0, 0, 0.75); font: ; }</style>
武當派
...
風清揚
矮老者
白仁甫

U n i o n ( ) 函 數 的 模 板 : Union()函式的模板: Union()

inline void Union(int x, int y) {	   //inline優化
	int t1 = Find(x), t2 = Find(y);    //尋找x的師父和y的師父
	if (t1 != t2) f[t2] = t1;		   //y認x做師父,兩個集合合并成一個
	return;
}

關于并查集,還有一個關鍵的地方,就是 初始化

void init() {
	for (int i = 1; i <= n; i++)
		f[i] = i; //在沒有認師之前,都是自學的,自己就是自己的師父,即自己就是自己的根
	return;
} 

下面是模板題的引入:

P3367 【模板】并查集

題目描述

如題,現在有一個并查集,你需要完成合并和查詢操作,

輸入格式

第一行包含兩個整數 N N N M M M,表示共有 N N N個元素和 M M M個操作,
接下來 M M M行,每行包含三個整數 Z i , X i , Y i Z_i,X_i,Y_i Zi?,Xi?,Yi?
Z i = 1 Z_i = 1 Zi?=1時,將 X i X_i Xi? Y i Y_i Yi?所在的集合合并,
Z i = 2 Z_i = 2 Zi?=2時,輸出 X i X_i Xi? Y i Y_i Yi?是否在同一個集合內,是的輸出 Y Y Y ;否則輸出 N N N

輸出格式

對于每一個 Z i = 2 Z_i = 2 Zi?=2的操作,都有一行輸出,每行包含一個大寫字母,為 Y Y Y或者 N N N

說明/提示

對于 30 % 30\% 30%的資料, N ≤ 10 , M ≤ 20 N≤10,M≤20 N10M20.,
對于 70 % 70\% 70%的資料, N ≤ 100 , M ≤ 1 0 3 N≤100,M≤10^3 N100M103
對于 100 % 100\% 100%的資料, 1 ≤ N ≤ 1 0 4 , 1 ≤ M ≤ 2 × 1 0 5 1≤N≤10^4,1≤M≤2×10^5 1N104,1M2×105

輸入樣例

4 7
2 1 2
1 1 2
2 1 2
1 3 4
2 1 4
1 2 3
2 1 4

輸出樣例

N
Y
N
Y

題目分析:模板題,套模板
C o d e Code Code

#include <bits/stdc++.h>
using namespace std;

int n, m;
int f[100050];

void init() {  //初始化
	for (int i = 1; i <= n; i++)
		f[i] = i;
}

inline int Find(int x) {  //找“根”
	if (f[x] == x) return x;
	else return f[x] = Find(f[x]);
} 

inline void Union(int x, int y) {  //合并集合
	int t1 = Find(x), t2 = Find(y);
	if (t1 != t2) f[t1] = t2;		
}

inline void Check(int x, int y) {  //檢查條件
	int t1 = Find(x), t2 = Find(y);
	if (t1 == t2) puts("Y");  //比printf還要快的函式,而且還會自動換行,但是只能參考 char 型別的變數
	else puts("N");  //更快,更靚,更強!!!
}

int main() {
	scanf("%d%d", &n, &m);
	init();
	while (m--) {
		int z, x, y;
		scanf("%d%d%d", &z, &x, &y);  
		if (z == 1) Union(x, y);
		else Check(x, y); 
	}
	return 0;  //完美結束
}

并查集的擴展域:

基本概念:

有些情況下,元素不只含有一個屬性,傳遞的關系也不只一種,因此我們可以將每個元素拆成多個元素,在合并的時候維護關系的傳遞性,通過擴展出來的屬性來維護傳遞性,
是不是聽起來很麻煩 ,但說白了就是把原來的集合擴大幾倍,然后在新的集合中建立關系,

P2024 [NOI2001]食物鏈

題目描述:

動物王國中有三類動物 A , B , C A,B,C A,B,C,這三類動物的食物鏈構成了有趣的環形, A A A B B B B B B C C C C C C A A A
現有 N 個動物,以 1 - N 編號,每個動物都是 A,B,C 中的一種,但是我們并不知道它到底是哪一種,
有人用兩種說法對這 N 個動物所構成的食物鏈關系進行描述:
●第一種說法是 1 X Y,表示 X X X Y Y Y 是同類,
●第二種說法是 2 X Y,表示 X X X Y Y Y
此人對 N 個動物,用上述兩種說法,一句接一句地說出 K 句話,這 K 句話有的是真的,有的是假的,
當一句話滿足下列三條之一時,這句話就是假話,否則就是真話,
判斷假話的條件
●當前的話與前面的某些真的話沖突,就是假話,
●當前的話中 X X X Y Y Y N N N 大,就是假話,
●當前的話表示 X X X X X X,就是假話,
你的任務是根據給定的 N 和 K 句話,輸出假話的總數,

輸入格式:
第一行兩個整數 N , K N,K NK,表示有 N N N 個動物, K K K 句話,
第二行開始每行一句話(按照題目要求,見樣例),

輸出格式:
一行,一個整數,表示假話的總數,

輸入樣例:

100 7
1 101 1
2 1 2
2 2 3
2 3 3
1 1 3
2 3 1
1 5 5

輸出樣例:

3

提示:
1 ≤ N ≤ 5 ? 1 0 4 1 ≤ N ≤ 5 ? 10^4 1N5?104
1 ≤ K ≤ 1 0 5 1 ≤ K ≤ 10^5 1K105

決議:
這道題需要保存三種關系,分別是:同類,獵物,天敵
所以可以擴展并查集, 從 n n n 變成 3 × n 3 × n 3×n
①用 x x x 表示 x x x的同類,
②用 x + n x + n x+n 表示 x x x的獵物,
③用 x + 2 × n x + 2 × n x+2×n表示 x x x的天敵,
假話的判斷如題所示,即為所求
那么,
d = 1 d=1 d=1且這句話是真話時,
d = 1 時 { U n i o n ( x , y ) ( x 和 y 是 同 類 ) U n i o n ( x + n , y + n ) ( x 的 獵 物 和 y 的 獵 物 是 同 類 ) U n i o n ( x + 2 ? n , y + 2 ? n ) ( x 的 天 敵 和 y 的 天 敵 是 同 類 ) d = 1 時 \left\{ \begin{matrix} Union(x, y) (x和y是同類) \\ Union(x + n, y + n) (x的獵物和y的獵物是同類)\\ Union(x + 2 * n, y + 2 * n)(x的天敵和y的天敵是同類)\\ \end{matrix} \right. d=1????Union(x,y)(xy)Union(x+n,y+n)(xy)Union(x+2?n,y+2?n)(xy)?
d = 2 d=2 d=2且這句話時真話時,
d = 2 時 { U n i o n ( x , y + 2 ? n ) ( x 是 y 的 天 敵 ) U n i o n ( x + n , y ) ( x 的 獵 物 是 y ) U n i o n ( x + 2 ? n , y + n ) ( x 的 天 敵 是 y 的 獵 物 ) d = 2 時 \left\{ \begin{matrix} Union(x, y + 2 * n)(x是y的天敵)\\ Union(x + n, y)(x的獵物是y)\\ Union(x + 2 * n, y + n)(x的天敵是y的獵物)\\ \end{matrix} \right. d=2????Union(x,y+2?n)(xy)Union(x+n,y)(xy)Union(x+2?n,y+n)(xy)?
C o d e : Code: Code:

#include <bits/stdc++.h>
using namespace std;

int ans;
int n, k;
int f[150005];

void init() {  //擴展域的初始化
	for (int i = 1; i <= 3 * n; i++) {
		f[i] = i;
	}
}

inline int Find(int x) {   //找根
	if (f[x] == x) return x;
	else return f[x] = Find(f[x]);
}

inline void Union(int x, int y) {  //合并集合
	int t1 = Find(x), t2 = Find(y);
	if (t1 != t2) f[t2] = t1;
}

inline bool check1(int x, int y) {  //判斷是否為同類
	if (Find(x + n) == Find(y) || Find(x + 2 * n) == Find(y)) 
		return true;
	else
	    return false;
}

inline bool check2(int x, int y) {  //判斷是否為獵物
	if (Find(x) == Find(y) || Find(x + 2 * n) == Find(y))
		return true;
	else 
		return false;
}

int main() {
	scanf("%d%d", &n, &k);
	init();
	while (k--) {
		int d, x, y;
		scanf("%d%d%d", &d, &x, &y);
		if (x > n || y > n) {ans++; continue;}
		switch(d) {  //聽說比if快一點
			case 1:	
				if (check1(x, y)) {ans++; continue;}
				else {
					Union(x, y);
					Union(x + n, y + n);
					Union(x + 2 * n, y + 2 * n);
				}
				break;
			case 2:
				if (check2(x, y)) {ans++; continue;}
				else {
					Union(x, y + 2 * n);
					Union(x + n, y);
					Union(x + 2 * n, y + n);
				}
				break;
		}
	}
	return !printf("%d", ans);//又省了一行
}

完結
(本篇博客將會持續更新)

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/239581.html

標籤:其他

上一篇:競猜小游戲

下一篇:python學習----2048小游戲

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • 網閘典型架構簡述

    網閘架構一般分為兩種:三主機的三系統架構網閘和雙主機的2+1架構網閘。 三主機架構分別為內端機、外端機和仲裁機。三機無論從軟體和硬體上均各自獨立。首先從硬體上來看,三機都用各自獨立的主板、記憶體及存盤設備。從軟體上來看,三機有各自獨立的作業系統。這樣能達到完全的三機獨立。對于“2+1”系統,“2”分為 ......

    uj5u.com 2020-09-10 02:00:44 more
  • 如何從xshell上傳檔案到centos linux虛擬機里

    如何從xshell上傳檔案到centos linux虛擬機里及:虛擬機CentOs下執行 yum -y install lrzsz命令,出現錯誤:鏡像無法找到軟體包 前言 一、安裝lrzsz步驟 二、上傳檔案 三、遇到的問題及解決方案 總結 前言 提示:其實很簡單,往虛擬機上安裝一個上傳檔案的工具 ......

    uj5u.com 2020-09-10 02:00:47 more
  • 一、SQLMAP入門

    一、SQLMAP入門 1、判斷是否存在注入 sqlmap.py -u 網址/id=1 id=1不可缺少。當注入點后面的引數大于兩個時。需要加雙引號, sqlmap.py -u "網址/id=1&uid=1" 2、判斷文本中的請求是否存在注入 從文本中加載http請求,SQLMAP可以從一個文本檔案中 ......

    uj5u.com 2020-09-10 02:00:50 more
  • Metasploit 簡單使用教程

    metasploit 簡單使用教程 浩先生, 2020-08-28 16:18:25 分類專欄: kail 網路安全 linux 文章標簽: linux資訊安全 編輯 著作權 metasploit 使用教程 前言 一、Metasploit是什么? 二、準備作業 三、具體步驟 前言 Msfconsole ......

    uj5u.com 2020-09-10 02:00:53 more
  • 游戲逆向之驅動層與用戶層通訊

    驅動層代碼: #pragma once #include <ntifs.h> #define add_code CTL_CODE(FILE_DEVICE_UNKNOWN,0x800,METHOD_BUFFERED,FILE_ANY_ACCESS) /* 更多游戲逆向視頻www.yxfzedu.com ......

    uj5u.com 2020-09-10 02:00:56 more
  • 北斗電力時鐘(北斗授時服務器)讓網路資料更精準

    北斗電力時鐘(北斗授時服務器)讓網路資料更精準 北斗電力時鐘(北斗授時服務器)讓網路資料更精準 京準電子科技官微——ahjzsz 近幾年,資訊技術的得了快速發展,互聯網在逐漸普及,其在人們生活和生產中都得到了廣泛應用,并且取得了不錯的應用效果。計算機網路資訊在電力系統中的應用,一方面使電力系統的運行 ......

    uj5u.com 2020-09-10 02:01:03 more
  • 【CTF】CTFHub 技能樹 彩蛋 writeup

    ?碎碎念 CTFHub:https://www.ctfhub.com/ 筆者入門CTF時時剛開始刷的是bugku的舊平臺,后來才有了CTFHub。 感覺不論是網頁UI設計,還是題目質量,賽事跟蹤,工具軟體都做得很不錯。 而且因為獨到的金幣制度的確讓人有一種想去刷題賺金幣的感覺。 個人還是非常喜歡這個 ......

    uj5u.com 2020-09-10 02:04:05 more
  • 02windows基礎操作

    我學到了一下幾點 Windows系統目錄結構與滲透的作用 常見Windows的服務詳解 Windows埠詳解 常用的Windows注冊表詳解 hacker DOS命令詳解(net user / type /md /rd/ dir /cd /net use copy、批處理 等) 利用dos命令制作 ......

    uj5u.com 2020-09-10 02:04:18 more
  • 03.Linux基礎操作

    我學到了以下幾點 01Linux系統介紹02系統安裝,密碼啊破解03Linux常用命令04LAMP 01LINUX windows: win03 8 12 16 19 配置不繁瑣 Linux:redhat,centos(紅帽社區版),Ubuntu server,suse unix:金融機構,證券,銀 ......

    uj5u.com 2020-09-10 02:04:30 more
  • 05HTML

    01HTML介紹 02頭部標簽講解03基礎標簽講解04表單標簽講解 HTML前段語言 js1.了解代碼2.根據代碼 懂得挖掘漏洞 (POST注入/XSS漏洞上傳)3.黑帽seo 白帽seo 客戶網站被黑帽植入劫持代碼如何處理4.熟悉html表單 <html><head><title>TDK標題,描述 ......

    uj5u.com 2020-09-10 02:04:36 more
最新发布
  • 2023年最新微信小程式抓包教程

    01 開門見山 隔一個月發一篇文章,不過分。 首先回顧一下《微信系結手機號資料庫被脫庫事件》,我也是第一時間得知了這個訊息,然后跟蹤了整件事情的經過。下面是這起事件的相關截圖以及近日流出的一萬條資料樣本: 個人認為這件事也沒什么,還不如關注一下之前45億快遞資料查詢渠道疑似在近日復活的訊息。 訊息是 ......

    uj5u.com 2023-04-20 08:48:24 more
  • web3 產品介紹:metamask 錢包 使用最多的瀏覽器插件錢包

    Metamask錢包是一種基于區塊鏈技術的數字貨幣錢包,它允許用戶在安全、便捷的環境下管理自己的加密資產。Metamask錢包是以太坊生態系統中最流行的錢包之一,它具有易于使用、安全性高和功能強大等優點。 本文將詳細介紹Metamask錢包的功能和使用方法。 一、 Metamask錢包的功能 數字資 ......

    uj5u.com 2023-04-20 08:47:46 more
  • vulnhub_Earth

    前言 靶機地址->>>vulnhub_Earth 攻擊機ip:192.168.20.121 靶機ip:192.168.20.122 參考文章 https://www.cnblogs.com/Jing-X/archive/2022/04/03/16097695.html https://www.cnb ......

    uj5u.com 2023-04-20 07:46:20 more
  • 從4k到42k,軟體測驗工程師的漲薪史,給我看哭了

    清明節一過,盲猜大家已經無心上班,在數著日子準備過五一,但一想到銀行卡里的余額……瞬間心情就不美麗了。最近,2023年高校畢業生就業調查顯示,本科畢業月平均起薪為5825元。調查一出,便有很多同學表示自己又被平均了。看著這一資料,不免讓人想到前不久中國青年報的一項調查:近六成大學生認為畢業10年內會 ......

    uj5u.com 2023-04-20 07:44:00 more
  • 最新版本 Stable Diffusion 開源 AI 繪畫工具之中文自動提詞篇

    🎈 標簽生成器 由于輸入正向提示詞 prompt 和反向提示詞 negative prompt 都是使用英文,所以對學習母語的我們非常不友好 使用網址:https://tinygeeker.github.io/p/ai-prompt-generator 這個網址是為了讓大家在使用 AI 繪畫的時候 ......

    uj5u.com 2023-04-20 07:43:36 more
  • 漫談前端自動化測驗演進之路及測驗工具分析

    隨著前端技術的不斷發展和應用程式的日益復雜,前端自動化測驗也在不斷演進。隨著 Web 應用程式變得越來越復雜,自動化測驗的需求也越來越高。如今,自動化測驗已經成為 Web 應用程式開發程序中不可或缺的一部分,它們可以幫助開發人員更快地發現和修復錯誤,提高應用程式的性能和可靠性。 ......

    uj5u.com 2023-04-20 07:43:16 more
  • CANN開發實踐:4個DVPP記憶體問題的典型案例解讀

    摘要:由于DVPP媒體資料處理功能對存放輸入、輸出資料的記憶體有更高的要求(例如,記憶體首地址128位元組對齊),因此需呼叫專用的記憶體申請介面,那么本期就分享幾個關于DVPP記憶體問題的典型案例,并給出原因分析及解決方法。 本文分享自華為云社區《FAQ_DVPP記憶體問題案例》,作者:昇騰CANN。 DVPP ......

    uj5u.com 2023-04-20 07:43:03 more
  • msf學習

    msf學習 以kali自帶的msf為例 一、msf核心模塊與功能 msf模塊都放在/usr/share/metasploit-framework/modules目錄下 1、auxiliary 輔助模塊,輔助滲透(埠掃描、登錄密碼爆破、漏洞驗證等) 2、encoders 編碼器模塊,主要包含各種編碼 ......

    uj5u.com 2023-04-20 07:42:59 more
  • Halcon軟體安裝與界面簡介

    1. 下載Halcon17版本到到本地 2. 雙擊安裝包后 3. 步驟如下 1.2 Halcon軟體安裝 界面分為四大塊 1. Halcon的五個助手 1) 影像采集助手:與相機連接,設定相機引數,采集影像 2) 標定助手:九點標定或是其它的標定,生成標定檔案及內參外參,可以將像素單位轉換為長度單位 ......

    uj5u.com 2023-04-20 07:42:17 more
  • 在MacOS下使用Unity3D開發游戲

    第一次發博客,先發一下我的游戲開發環境吧。 去年2月份買了一臺MacBookPro2021 M1pro(以下簡稱mbp),這一年來一直在用mbp開發游戲。我大致分享一下我的開發工具以及使用體驗。 1、Unity 官網鏈接: https://unity.cn/releases 我一般使用的Apple ......

    uj5u.com 2023-04-20 07:40:19 more