fork download
  1. struct Sol {
  2. void Test() {
  3. int n;
  4. cin>>n;
  5. VVI slo(n + 2);
  6. VI pars(n + 2);
  7. FOR (i, 2, n) {
  8. int par;
  9. cin>>par;
  10. pars[i] = par;
  11. slo[i].PB(par);
  12. slo[par].PB(i);
  13. }
  14. LCA lca(slo);
  15. HLDSum hld(slo, n, false);
  16. int q;
  17. cin>>q;
  18. REP (_, q) {
  19. int typ;
  20. cin>>typ;
  21. if (typ == 2) {
  22. int v;
  23. cin>>v;
  24. hld.Upd(v, pars[v], 1);
  25. } else {
  26. int a, b;
  27. cin>>a>>b;
  28. int dis = lca.Dis(a, b);
  29. dis -= hld.Query(a, b);
  30. cout<<dis<<"\n";
  31. }
  32. }
  33. }
  34. };
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In member function 'void Sol::Test()':
prog.cpp:4:5: error: 'cin' was not declared in this scope
     cin>>n;
     ^
prog.cpp:5:5: error: 'VVI' was not declared in this scope
     VVI slo(n + 2);
     ^
prog.cpp:6:5: error: 'VI' was not declared in this scope
     VI pars(n + 2);
     ^
prog.cpp:7:10: error: 'i' was not declared in this scope
     FOR (i, 2, n) {
          ^
prog.cpp:7:17: error: 'FOR' was not declared in this scope
     FOR (i, 2, n) {
                 ^
prog.cpp:14:5: error: 'LCA' was not declared in this scope
     LCA lca(slo);
     ^
prog.cpp:15:5: error: 'HLDSum' was not declared in this scope
     HLDSum hld(slo, n, false);
     ^
prog.cpp:18:10: error: '_' was not declared in this scope
     REP (_, q) {
          ^
prog.cpp:18:14: error: 'REP' was not declared in this scope
     REP (_, q) {
              ^
stdout
Standard output is empty