
include <stdio.h>
#include <ctype.h>
    
int par[100000];
    
void init(int);
int dep(int);
int inp(void);
   
char *p;
char in[1500000];
int tree[100000][15],idx[100000];
   
int main(){
  int n,i,j,id,k,c;
   
  fread(in,sizeof(in),1,stdin);  
  p = in;
   
  n = inp(); init(n);
  for(i = 0 ; i < n ; i++){
    id = inp();
    k = inp();
    for(j = 0 ; j < k ; j++){
      c = inp();
      par[c] = id;
      tree[id][idx[id]++] = c;
    }
  }
    
  for(i = 0 ; i < n ; i++){
    printf("node %d: parent = %d, depth = %d, "
           ,i,par[i],dep(i));
       
    if(par[i] == -1){
      printf("root, [");
    }else if(!idx[i]){
      printf("leaf, [");
    }else{
      printf("internal node, [");
    }
   
    for(j = 0 ; j < idx[i] ; j++){
      printf("%d",tree[i][j]);
      if(j < idx[i]-1) printf(", ");
    }
    puts("]");
  }
  return 0;
}
   
void init(int n){
  int i;
  for(i = 0 ; i < n ; i++){
    par[i] = -1;
  }
}
   
int dep(int x){
  if(par[x] == -1) return 0;
  return dep(par[x]) + 1;
}
   
int inp(){
  int v = 0;
  while(!isdigit(*p)) ++p;
  v = *p++&15;
  while(isdigit(*p)){
    v = (v<<3)+(v<<1)+(*p++&15);
  }
  return v;
}
 

 
Compile Error Logs: 

You are not authorized to see the message. 
 
 
??????????????? 
Judge: 8/8  C  CPU: 00.02 sec  Memory: 4072 KB  Length: 1152 B  2017-11-18 23:04  2017-11-18 23:04  
???????????±????????????????????? 
Case # Verdict CPU Time Memory In Out Case Name 
 Case #1: : Accepted  00.00 sec 1820 KB 6 B 41 B test_case_1 
 Case #2: : Accepted  00.00 sec 1740 KB 24 B 168 B test_case_2 
 Case #3: : Accepted  00.00 sec 1812 KB 42 B 311 B test_case_3 
 Case #4: : Accepted  00.00 sec 1740 KB 85 B 591 B test_case_4 
 Case #5: : Accepted  00.00 sec 1752 KB 69 B 506 B test_case_5 
 Case #6: : Accepted  00.00 sec 1812 KB 189 B 1236 B test_case_6 
 Case #7: : Accepted  00.02 sec 3912 KB 1377789 B 5077776 B test_case_7 
 Case #8: : Accepted  00.02 sec 4072 KB 1387784 B 5436666 B test_case_8 



 < prev | 1 /  8 | next >      : Accepted        00.00 sec        1820 KB 

 

Judge Input #1 ( in1.txt | 6 B)  Judge Output #1 ( out1.txt | 41 B) 

1
0 0

  
node 0: parent = -1, depth = 0, root, []

 

Comments 
 

 ??\????????§?????? 

 
Categories 
 



 
Free Tags 
 



 



 
   










 

        

 

 
Aizu Online Judge
 follow us on Twitter






About us
 
ContactSystem InfoThe University of AizuUniv. of Aizu Competitive Programming Club


Tools
 
WEB Board ToolsVirtual ArenaAPI ReferenceTutorial


Links
 
ACM/ICPCACM/ICPC Asia JapanACM-ICPC OB/OG Alumni GroupPC KoshienJOI

AtCoderTopCoderCodeForces

Uva Online judgesACM-ICPC Live ArchivePKU JudgeOnline 

Aizu IT Arena 


Best viewed using Firefox, Google Chrome

Aizu Online Judge Version 1.0 ?? 2004 - 2016 Univ. of Aizu Competitive Programming Club (ICPCPC), Database Systems 