I tried solving the problem SMPAIR using stacks but I keep ending up with SIGTSTP error and TLE. I went through my program but couldnt spot any apparent mistakes. Why am I getting this? Is there any improvement needed in my code? link to my code. Thank you!

Well there are two errors in your code.
at line no 39 you are assigning not comparing.
at line no 41 you are assigning not comparing.

By resolving these two you’ll not get tle.

Even when u resolve these you will still get a wrong answer.
1)You have to remove destructor print statement.
2)At end of each testcases you have to print new line.

Now you’ll get ac.Btw nice approach.

1 Like

Yeah got it. Thanks a lot!

I may not solve ur issue but check out stl in c++ it has builtin functions and data structure like stack,deque,queue etc

1 Like