文章
25
粉丝
137
获赞
7
访问
128.9k
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> FindLevel(int parent[],int start) {
vector<int> vec;
while (parent[start]) {
vec.push_back(start);
start = parent[start];
}
vec.push_back(start);
return vec;
}
int main()
{
int t, n, m, lchild, rchild, end1, end2;
vector<int> vec_end1, vec_end2;
cin >> t;
while (t--) {
cin >> n >> m;
//int* parent = new int[n + 1];
int parent[100];
//根节点的父节点设为0
parent[1] = 0;
...
登录后发布评论
暂无评论,来抢沙发