Language: C


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 

Compiler output:
main.c:2:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    2 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:18:3: error: implicit declaration of function 'fread' [-Wimplicit-function-declaration]
   18 |   fread(in,sizeof(in),1,stdin);
      |   ^~~~~
main.c:18:25: error: 'stdin' undeclared (first use in this function)
   18 |   fread(in,sizeof(in),1,stdin);
      |                         ^~~~~
main.c:4:1: note: 'stdin' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
    3 | #include <ctype.h>
  +++ |+#include <stdio.h>
    4 | 
main.c:18:25: note: each undeclared identifier is reported only once for each function it appears in
   18 |   fread(in,sizeof(in),1,stdin);
      |                         ^~~~~
main.c:33:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   33 |     printf("node %d: parent = %d, depth = %d, "
      |     ^~~~~~
main.c:33:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:33:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:33:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:48:5: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
   48 |     puts("]");
      |     ^~~~
main.c:48:5: note: include '<stdio.h>' or provide a declaration of 'puts'
main.c: At top level:
main.c:77:1: error: unknown type name 'Compile'
   77 | Compile Error Logs:
      | ^~~~~~~
main.c:77:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Logs'
   77 | Compile Error Logs:
      |               ^~~~
main.c:84:12: error: stray '\302' in program
   84 | ???????????<U+00B1>?????????????????????
      |            ^~~~~~~~
main.c:85:6: error: stray '#' in program
   85 | Case # Verdict CPU Time Memory In Out Case Name
      |      ^
main.c:86:7: error: stray '#' in program
   86 |  Case #1: : Accepted  00.00 sec 1820 KB 6 B 41 B test_case_1
      |       ^
main.c:87:7: error: stray '#' in program
   87 |  Case #2: : Accepted  00.00 sec 1740 KB 24 B 168 B test_case_2
      |       ^
main.c:88:7: error: stray '#' in program
   88 |  Case #3: : Accepted  00.00 sec 1812 KB 42 B 311 B test_case_3
      |       ^
main.c:89:7: error: stray '#' in program
   89 |  Case #4: : Accepted  00.00 sec 1740 KB 85 B 591 B test_case_4
      |       ^
main.c:90:7: error: stray '#' in program
   90 |  Case #5: : Accepted  00.00 sec 1752 KB 69 B 506 B test_case_5
      |       ^
main.c:91:7: error: stray '#' in program
   91 |  Case #6: : Accepted  00.00 sec 1812 KB 189 B 1236 B test_case_6
      |       ^
main.c:92:7: error: stray '#' in program
   92 |  Case #7: : Accepted  00.02 sec 3912 KB 1377789 B 5077776 B test_case_7
      |       ^
main.c:93:7: error: stray '#' in program
   93 |  Case #8: : Accepted  00.02 sec 4072 KB 1387784 B 5436666 B test_case_8
      |       ^
main.c:101:13: error: stray '#' in program
  101 | Judge Input #1 ( in1.txt | 6 B)  Judge Output #1 ( out1.txt | 41 B)
      |             ^
main.c:101:47: error: stray '#' in program
  101 | Judge Input #1 ( in1.txt | 6 B)  Judge Output #1 ( out1.txt | 41 B)
      |                                               ^
main.c:114:4: error: stray '\' in program
  114 |  ??\????????§??????
      |    ^
main.c:114:13: error: stray '\302' in program
  114 |  ??\????????<U+00A7>??????
      |             ^~~~~~~~