SystemTesting's blog

By SystemTesting, history, 10 months ago, In English

I've tried every possible way to figure out the problem. But could not figure it out still why it's getting a runtime error on Test Case 3. Please can someone help me with this?? Here's the code 249223416 and here's the problem 1791F - Range Update Point Query

  • Vote: I like it
  • -1
  • Vote: I do not like it

»
10 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by SystemTesting (previous revision, new revision, compare).

»
10 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

You don't need to do allat bro. I haven't done competitive programming in YEARS, but I think literally all you have to do is calculate the digital root for each a_i until you end up with a single digit (and you literally could save this in a N by 4 array or sum), use a difference array to simulate the range queries, and then answer the queries that way (it's O(N) too).

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

    Oh, I'm stupid this shouldn't work. But shouldn't a Fenwick tree work fine here?

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

      Yeah a fenwick tree could have worked here, but didn't want to overkill the problem.

»
10 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Because you dereference it (in the end of cycle) after possible erasing (in successful if num < 10)