It is about multithreading. I tried to solve FCTRL2 using this method, and it worked. But my serial program ran faster than the parallel one. Then I found some programs of gkcs which run faster when using multiple processors. I have two doubts.
Is multithreading allowed on all platforms like Topcoder, Codeforces, etc…
If my program was using 1 unit of memory, will using 4 processors make it 4 units?
Also, is there a bug in my code? I can’t understand why the first solution ran slower than the second.