Language: C

#include<stdio.h>
#define NIL -1
 
int D[10000],H[10000];
 
struct Node{
  int parent,left,right;
    };
  struct Node T[10000];
void print(int);
int dep;
 
int main(){
  int i,p,r,l,root=0,n;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].parent = NIL;
    T[i].left = NIL;
    T[i].right = NIL;
  }
  for(i=0;i<n;i++){
    scanf("%d%d%d", &p, &l, &r);
    T[l].parent = p;
    T[r].parent = p;
    T[p].left = l;
    T[p].right = r;
    
  }
  for(i=0;i<n;i++){
    print(i);
  }
  return 0;
}
 
   
int setDepth(int u){
   
    if(T[u].parent == NIL)return 0;
    if(T[u].parent!=NIL){
      dep++;
      setDepth(T[u].parent);
  }
    return dep;
}
 
int setHeight(int u){
  int h1 = 0,h2 = 0;
  if(T[u].left!=NIL){
    h1 = setHeight(T[u].left)+1;
  }
  if(T[u].right!=NIL){
    h2 = setHeight(T[u].right)+1;
  }
  if(h1 > h2) return h1;
  else return h2;
}
 
   
int Sibling(int u){
  if(T[u].parent == NIL) return NIL;
  else if(T[T[u].parent].left!=u && T[T[u].parent].left!=NIL){
    return T[T[u].parent].left;
  }
  else if(T[T[u].parent].right!=u && T[T[u].parent].right!=NIL) {
    return T[T[u].parent].right;
  }
  return NIL;
}
 
void print(int u){
  int deg = 0;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].parent); 
  printf("sibling = %d, ",Sibling(u));
  if(T[u].right!=NIL) deg++;
  if(T[u].left!=NIL) deg++;
  printf("degree = %d, ",deg);
  dep = 0;
  printf("depth = %d, ",setDepth(u));
  printf("height = %d, ",setHeight(u));
  if(T[u].parent == NIL) printf("root\n");
  else if(T[u].left==NIL && T[u].right==NIL) printf("leaf\n");
  else printf("internal node\n");
}

Compile Error Logs:
You are not authorized to see the message.

???????????????
Judge: 8/8	C	CPU: 00.00 sec	Memory: 620 KB	Length: 1593 B	2015-07-10 16:57	2015-07-10 16:57
???????????±?????????????????????
Case #	Verdict	CPU Time	Memory	In	Out	Case Name
Case #1:	: Accepted	00.00 sec	620 KB	38 B	376 B	1.in
Case #2:	: Accepted	00.00 sec	620 KB	10 B	75 B	2.in
Case #3:	: Accepted	00.00 sec	620 KB	31 B	315 B	3.in
Case #4:	: Accepted	00.00 sec	620 KB	52 B	531 B	4.in
Case #5:	: Accepted	00.00 sec	620 KB	66 B	686 B	5.in
Case #6:	: Accepted	00.00 sec	620 KB	52 B	553 B	6.in
Case #7:	: Accepted	00.00 sec	620 KB	164 B	1594 B	7.in
Case #8:	: Accepted	00.00 sec	620 KB	199 B	1955 B	8.in

< prev |	1	/	8	| next >	 		 : Accepted        00.00 sec        620 KB
 
Judge Input #1 ( in1.txt | 38 B)		Judge Output #1 ( out1.txt | 376 B)
5
3 4 0
4 -1 -1
1 -1 -1
2 -1 -1
0 1 2
node 0: parent = 3, sibling = 4, degree = 2, depth = 1, height = 1, internal node
node 1: parent = 0, sibling = 2, degree = 0, depth = 2, height = 0, leaf
node 2: parent = 0, sibling = 1, degree = 0, depth = 2, height = 0, leaf
node 3: parent = -1, sibling = -1, degree = 2, depth = 0, height = 2, root
node 4: parent = 3, sibling = 0, degree = 0, depth = 1, height = 0, leaf
Comments
 
 ??\????????§??????
 
Categories
 
 
Free Tags
 
 

Compiler output:
main.c:86:1: error: unknown type name 'Compile'
   86 | Compile Error Logs:
      | ^~~~~~~
main.c:86:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Logs'
   86 | Compile Error Logs:
      |               ^~~~
main.c:91:12: error: stray '\302' in program
   91 | ???????????<U+00B1>?????????????????????
      |            ^~~~~~~~
main.c:92:6: error: stray '#' in program
   92 | Case #  Verdict CPU Time        Memory  In      Out     Case Name
      |      ^
main.c:93:6: error: stray '#' in program
   93 | Case #1:        : Accepted      00.00 sec       620 KB  38 B    376 B   1.in
      |      ^
main.c:93:73: error: invalid suffix "in" on floating constant
   93 | Case #1:        : Accepted      00.00 sec       620 KB  38 B    376 B   1.in
      |                                                                         ^~~~
main.c:94:6: error: stray '#' in program
   94 | Case #2:        : Accepted      00.00 sec       620 KB  10 B    75 B    2.in
      |      ^
main.c:94:73: error: invalid suffix "in" on floating constant
   94 | Case #2:        : Accepted      00.00 sec       620 KB  10 B    75 B    2.in
      |                                                                         ^~~~
main.c:95:6: error: stray '#' in program
   95 | Case #3:        : Accepted      00.00 sec       620 KB  31 B    315 B   3.in
      |      ^
main.c:95:73: error: invalid suffix "in" on floating constant
   95 | Case #3:        : Accepted      00.00 sec       620 KB  31 B    315 B   3.in
      |                                                                         ^~~~
main.c:96:6: error: stray '#' in program
   96 | Case #4:        : Accepted      00.00 sec       620 KB  52 B    531 B   4.in
      |      ^
main.c:96:73: error: invalid suffix "in" on floating constant
   96 | Case #4:        : Accepted      00.00 sec       620 KB  52 B    531 B   4.in
      |                                                                         ^~~~
main.c:97:6: error: stray '#' in program
   97 | Case #5:        : Accepted      00.00 sec       620 KB  66 B    686 B   5.in
      |      ^
main.c:97:73: error: invalid suffix "in" on floating constant
   97 | Case #5:        : Accepted      00.00 sec       620 KB  66 B    686 B   5.in
      |                                                                         ^~~~
main.c:98:6: error: stray '#' in program
   98 | Case #6:        : Accepted      00.00 sec       620 KB  52 B    553 B   6.in
      |      ^
main.c:98:73: error: invalid suffix "in" on floating constant
   98 | Case #6:        : Accepted      00.00 sec       620 KB  52 B    553 B   6.in
      |                                                                         ^~~~
main.c:99:6: error: stray '#' in program
   99 | Case #7:        : Accepted      00.00 sec       620 KB  164 B   1594 B  7.in
      |      ^
main.c:99:73: error: invalid suffix "in" on floating constant
   99 | Case #7:        : Accepted      00.00 sec       620 KB  164 B   1594 B  7.in
      |                                                                         ^~~~
main.c:100:6: error: stray '#' in program
  100 | Case #8:        : Accepted      00.00 sec       620 KB  199 B   1955 B  8.in
      |      ^
main.c:100:73: error: invalid suffix "in" on floating constant
  100 | Case #8:        : Accepted      00.00 sec       620 KB  199 B   1955 B  8.in
      |                                                                         ^~~~
main.c:104:13: error: stray '#' in program
  104 | Judge Input #1 ( in1.txt | 38 B)                Judge Output #1 ( out1.txt | 376 B)
      |             ^
main.c:104:62: error: stray '#' in program
  104 | Judge Input #1 ( in1.txt | 38 B)                Judge Output #1 ( out1.txt | 376 B)
      |                                                              ^
main.c:118:4: error: stray '\' in program
  118 |  ??\????????§??????
      |    ^
main.c:118:13: error: stray '\302' in program
  118 |  ??\????????<U+00A7>??????
      |             ^~~~~~~~