BDGFT - I am unable to find any flaw in this solution but got WA

Problem Link - here
WA solution Link - here
Just changed the way of checking then got AC, solution Link - here

Please help to find flaw in that WA solution
Thank You

2 Likes

You need to add check on line 60

while(idx < v.size() and i+v[idx]-1<=s.size())

Invalid access can give WA or RE. C++ is weird if proper care is not taken. Accepted Code.

1 Like

Thanks a lot…!!
I was just finding error in logic because of WA verdict.