#include <iostream> using namespace std; int n; //x为下标 int getFather(int arr[],int x){ while(arr[x] !=-1){ x = arr[x]; } return x; } void joint(int arr[],int a,int b){ int aFather = getFather(arr,a); int bFather = getFather(arr,b); if(aFather == bFather)return; ...