c0despring1's blog

By c0despring1, history, 3 months ago, In English,

I recently tried to solve Div 3 D problem and keep on getting Runtime error on 5th case. Not able to figure out the reason behind it.

https://codeforces.com/contest/999/submission/39512943 (link for the submission)

https://codeforces.com/contest/999/problem/D (link for the problem)

 
 
 
 

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

Diagnostics actually shows the reason.
Error: attempt to subscript container with out-of-bounds index 0, but container only holds 0 elements.

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

    With all respect, I don't know much about out of bound error. Is that something related to the fact that I'm trying to access the index which is actually not allowed??

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

      Yes, you are trying to access 0th element of some vector when it's actually empty.