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

Автор denilb, 8 месяцев назад, По-английски

Hi, I can't find the reason my code doesn't pass test 3. After trying c++, I implemented the same code in python and it got TLE on test 9, so I'm clueless. Any help appreciated

B. Beautiful Contest

My code

EDIT: Thank you all for your help, I wrongly declared b as an int in the main function (C++ isn't my main language). I got it accepted now.

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

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

You saw that $$$-10^{17} \le b_i \le 10^{17}$$$, right?

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

    Damn, I thought about it when I implemented modify() but not in the main function. C++ isn't my main language, thanks for your help

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

If the Python code is the same but the C++ code doesn't work, then it's likely due to a data type issue. Indeed, you set the variable $$$b$$$ as int in the input part.

Btw I've also been stuck in this problem for a few days because I don't know how to implement the solution.