正文
增加 4 行删除 4 行
9 行未改动10111213141516171819202122232425262728293031323334353637383940116 行未改动全部展开9 行未改动typedef struct {int type;int root[307];int loop[307];inline void init(int n){for (register int i = 1; i <= n; i++){root[i] = i;loop[i] = 0;}}int get_root(int x){if (root[x] == x) return x;return root[x] = get_root(root[x]);}inline void merge(int x, int y){int x_root = get_root(x), y_root = get_root(y);if (x_root != y_root){root[x_root] = y_root;loop[y_root] += loop[x_root];} else {loop[x_root]++;}}inline bool check(int x, int y){int x_root = get_root(x), y_root = get_root(y);if (x_root != y_root) return loop[x_root] + loop[y_root] < type;return x_root != y_root || (type == 2 && loop[x_root] == 0);116 行未改动全部展开9 行未改动10111213141516171819202122232425262728293031323334353637383940116 行未改动全部展开9 行未改动typedef struct {int type;int root[307];int loop[307];inline void init(int n){for (register int i = 1; i <= n; i++){root[i] = i;loop[i] = 0;}}int get_root(int x){if (root[x] == x) return x;return root[x] = get_root(root[x]);}inline void merge(int x, int y){int x_root = get_root(x), y_root = get_root(y);if (x_root != y_root){root[x_root] = y_root;loop[y_root] += loop[x_root];} else {loop[x_root]++;}}inline bool check(int x, int y){int x_root = get_root(x), y_root = get_root(y);if (x_root != y_root) return loop[x_root] + loop[y_root] < type;return x_root != y_root || (type == 2 && loop[x_root] == 0);116 行未改动全部展开