So, I was solving a question and OJ accepted my answer partly, I guess this is because of the time complexity of my code but I'm unable to optimize it further. Here's the question:
Input: First line will contain an integer t, followed by t numbers of strings.Next line contains integer n followed by n number of queries consisting of r and spaced string p.
Output: contains single lexicographically smallest common prefix string.
I only recently started to use that site, but it seems possible to get Time Limit Expired (TLE) and your answer could still be wrong (WA). It just cuts off if the time is greater, not giving your program a chance to finish.
There was a recent explosion of threads asking for help on the June contest problems, so if you just browse other threads here you may learn some tips.
I'll tell you right now that straight-up arrays are too slow. Btw, why did you include <algorithm> ? You're not using anything from there...might help if you do.
I got 5/6 accepted and one answer threw some kind of SIGSEV runtime error, which got me questioning whether the input even matches the constraints.