Блог пользователя ysymyth

Автор ysymyth, 10 лет назад, По-английски

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.com/contest/431/submission/6702556)

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

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

  • Проголосовать: нравится
  • +9
  • Проголосовать: не нравится

»
10 лет назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

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

  • »
    »
    10 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

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

    • »
      »
      »
      10 лет назад, # ^ |
        Проголосовать: нравится +8 Проголосовать: не нравится

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