deepak_prakash's blog

By deepak_prakash, history, 6 years 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.net/contest/999/submission/39512943 (link for the submission)

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

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
6 years 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.

  • »
    »
    6 years 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??

    • »
      »
      »
      6 years 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.