This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <map> | |
#include <vector> | |
using namespace std; | |
map<string, int> Map; | |
string Name[105]; | |
vector<int> toNxt[105]; | |
int beConnected[105]; //該node被其他點連入的數量 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <algorithm> | |
#include <queue> | |
using namespace std; | |
struct custom_type { | |
int val; | |
int pos; | |
bool operator < (const custom_type &B) const { | |
return val > B.val; // min heap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <algorithm> | |
#include <queue> | |
using namespace std; | |
struct custom_type { | |
int val; | |
int pos; | |
bool operator < (const custom_type &B) const { | |
return val > B.val; // min heap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <cstring> | |
using namespace std; | |
char Preorder[30], Inorder[30]; | |
void Postorder(int PL, int PR, int IL, int IR); | |
int FindInorderRoot(char c, int L, int R); | |
int main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <vector> | |
using namespace std; | |
int Root[100010]; | |
vector<int> Set[100010]; | |
void Set_Initial(int N); | |
void Union(int x, int y); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <map> | |
#include <string> | |
using namespace std; | |
int Set[200010]; | |
int Num[200010]; | |
void Set_Initial(int N); | |
int FindRoot(int x); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <map> | |
#include <string> | |
using namespace std; | |
map<string, int> Map; | |
int Set[5010]; | |
int Num[5010]; | |
void Set_Initial(int N); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
using namespace std; | |
int Set[30010]; // Set[i]為i這node的father node,Set最上層的Set[root]=root | |
int Num[30010]; // 以N[i]為root的Set有幾個element | |
void Set_Initial(int N); | |
int FindRoot(int x); | |
void Union(int x, int y); | |
int FindLargest(int N); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <set> | |
using namespace std; | |
int Set[50010]; | |
int nOfReligion; | |
void Set_Initial(int N); | |
int FindRoot(int x); | |
void Union(int x, int y); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
using namespace std; | |
int Set[100001]; | |
int nOfNets; | |
int getNum(char line[], int &i); | |
void MakeSet(int n); | |
int FindSetRoot(int x); | |
void Union(int x, int y); |