Https://ide.codingblocks.com/s/601992 TLE prob

My code shows TLE when submitted, is there any more efficient way or should i use STL?

your mistakes

  1. print endl after each testcase
  2. head1 and head2 should be declare inside while loop for each testcase

Modified code

can u provide me with this ans using STL, i am unable to code it using STL

can you post and another doubt for this?

sure, thanks for ur help in this, have cleared all testcases without STL

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.