普通树或有向图转二叉树
//转二叉树
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
struct Node{
int l,r;
};
vector<int>E[310];//图的邻接表
int score[310],brother[310],n,m;//学分, n总课程树量,m 选课数
bool vist[310];
Node tree[310];//二叉树
void DfsTree(int v)
{
vist[v]=1;
cout<<"a"<<endl;
if (E[v].size()>0) tree[v].l=E[v][0];
tree[v].r=brother[v];
for(int i=0;i<E[v].size();i++)
if(!vist[E[v][i]]) DfsTree(E[v][i]);
}
int main()
{
scanf("%d%d",&n,&m);//n总课程数,m 选课数
int i,father,s;
for(i=1;i<=n;i++)//建立邻接表
{
scanf("%d%d",&father,&am