Test cases failing

My code is running fine but no test cases is passing. i am unable to resolve that

https://ide.codingblocks.com/s/594119 i have made a few changes in ur code…its working fine now

what i was doing wrong can you please point out that part

as its a completely changed code and i just want to output directly without storing it in a vector

i have used this input and output vector just to make things clear… ur code is failing bcoz of wrong input only…
consider this input where t is not 1
2
6
5 15 1 3 2 8
6
5 15 1 3 2 8

here ur code is giving wrong o/p bcoz input is not managed properly
ur o/p
5 10 5 4 3 4
15 4 3 3 3

expected o/p
5 10 5 4 3 4
5 10 5 4 3 4

hope it clears all ur doubts

https://ide.codingblocks.com/s/594144 I have made changes in ur code also without using input and output vectors… it also working fine now…
hope it clears ur doubts

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.