Need help to understand RTE
Difference between en1 and en2, changed 49 character(s)
Need help to understand RTE↵
==================↵
I was practicing [this problem](http://codeforces.net/contest/1650/problem/F). Now, following events occurred in chronological order (Along with other submissions, these are key submissions to my question)↵

1. This [code](http://codeforces.net/contest/1650/submission/149197417) received verdict _WA on 4_.↵
2. This [code](http://codeforces.net/contest/1650/submission/149197065) received verdict _RTE on 3_.↵
3. This [code](http://codeforces.net/contest/1650/submission/149197365) received _AC_↵

From 2 to 3, (RTE to AC) I only changed one thing, while looping over a vector in reverse order, I was using the following loop construct↵


~~~~~↵
for(ll i = v.size()-1; i >= 0; i--)↵
~~~~~↵

But after I realized that the `v.size()` is unsigned, so I might have to convert to `(ll)` first. So changing the loop to the following code got me AC.↵

~~~~~↵
for(ll i = (ll)v.size()-1; i >= 0; i--)↵
~~~~~↵

Here is the [diff](https://www.diffchecker.com/Pdj8UY68) between the RTE code and AC code.↵

Now, I had made the same mistake when I received WA on 4. That means without type casting to `ll`, my code passed the case 3. (Because it received WA on 4). But shouldn't the same code receive RTE on 3?? ↵

Here is the [diff](https://www.diffchecker.com/wDAs6MM5) between the WA code and RTE code.↵

Is it just undefined behavior? Or there is a specific reason behind this?↵

Can anyone help me by explaining this?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English souravvv 2022-03-11 03:07:24 49 Tiny change: 'Need help to understand RTE\n==================\nI was prac' -> 'I was prac'
en1 English souravvv 2022-03-11 03:06:48 1496 Initial revision (published)