"A. Jellyfish and Undertale " A better solution Solution link
Suppose there is no such bug as "a" then the total time for the bomb to explode will be the sum of the tools + b. In the question, we have given "a" so if we get any tool that is greater than "a" then we should add "a" rather than adding the tool that is greater than "a".
Hope it helps.
It's the same solution.
Why make a vector and then use
accumulate()
instead of just summing the values directly?