arilato's blog

By arilato, 10 years ago, In English

When I submit my code here for Problem C to Codeforces Round 291, it gives me runtime error although I've tried my code both on my local compiler and on ideone.com, both of which give me correct outputs. Why is this happening? Any help would be appreciated.

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
10 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

You need to create an empty node constructor like this: node() { child[0] = child[1] = child[2] = nullptr; }

If you do not do this neither of child[i] will be nullptr. (Kinda sad that I'm not good enough to prove what's wrong exactly here, I just know that this works, hope somebody will help you further if you will need more assistance)

P.S. Learn me how to use BB-code to write code samples properly, I still couldn't get any guide or anything that would help me with this case.