DIGJUMP- not using clear() function causes tle

I am doing a simple BFS for this question. I maintain a hashed list of the digit postions in a vector.
And then i push into the queue the indexes c+1,c-1 and the hashed ones.(Normal BFS).
Now this fact surprised me that when i did not use clear() function, i was getting TLE. Got AC after clearing the lists for visited digits.Can anyone explain why??
the submission id are-6489474(TLE)
AC-6489500

PS-Spent a lot of time on this seemingly simple question.Thanks in advance.

Because the size of vectors kept on increasing and after a certain test case it would be storing a very very large graph…traversing which would cause TLE.

Yes… i absolutely agree with u. But , here i am not visiting the row a second time(by using the visited array). So why bother clearing the rows if i never traverse them later.