ysymyth's blog

By ysymyth, 10 years ago, In English

Hi everyone! when I try to solve a problem using treap of size 100000, I use something like

struct node { ... node * ch[2]; }

and I keep MLE (see http://codeforces.net/contest/431/submission/6702556)

... and when I switch the language to C++0x, I got AC ( see http://codeforces.net/contest/431/submission/6702604)

so I got confused about differences of those two language. Can anyone explain it to me ? Thank you in advance!

  • Vote: I like it
  • +9
  • Vote: I do not like it

»
10 years ago, # |
  Vote: I like it +9 Vote: I do not like it

The difference is in randseed. I've submitted the second code under GNU C++ and it got AC as well.

  • »
    »
    10 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    But how can rand seed effect the memory ? ...

    • »
      »
      »
      10 years ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      Your tree structure depends on randseed. For example, there could be some loop in the tree which lead to stack overflow.