Unable to pass test Cases(Flood Fill)

I am not able understand why wrong answer is coming,i used the same approach as taught in the video section.
My code:

hello @Vishal_234
a) image
you forgot to add 1 in ans.

b) compress ur array .(by removing consective same elements ).

refer this -> https://codeforces.com/contest/1114/submission/49840468

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.