Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

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

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

I got Wrong Answer on test #26 in the final system test on this problem : Greg and Array

I used binary indexed trees to solve the problem. Since the full test case is not visible, I am unable to find my mistake. Here is the code I submitted: Source Code

I first calculated the number of operations of each kind on the array (op[] in the code) and then used this to find the total value change in the final array (query[] in the code). I printed the result after adding the total value changes to the original array values.

Any help on what am I doing wrong or other optimizations would be highly appreciated. I am a beginner and this is the first time I used binary indexed tree in my submission during a contest.

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

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

Expression d[t]*op[t] may overflow!

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

    Oh right! Silly mistake :( I just submitted again in practice and got Accepted (Code). Thanks for the help :)