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
Auto comment: topic has been updated by SystemTesting (previous revision, new revision, compare).
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).
Oh, I'm stupid this shouldn't work. But shouldn't a Fenwick tree work fine here?
Yeah a fenwick tree could have worked here, but didn't want to overkill the problem.
Because you dereference
it
(in the end of cycle) after possible erasing (in successfulif num < 10
)Ohhhh, shoot bruhhh, you are a life saviour. Thanks mann.