Physical exercise from november long challenge

I was comparing algorithm approach for physical exercise. I tried to solve it using divide and conquer but failed and ended up writing brute force appraoch… Because of which second sub task I got TLE. My solution using nodejs: CodeChef: Practical coding for everyone

Order of complexity (O(NMK))

I checked one of the participants solution. And it also uses brute force approach but its way more faster. In this participant uses c++.
https://www.codechef.com/viewsolution/27650041

Order of complexity (O(NMK))

My question to admin is are nodejs solutions are run in environment whose processors are having low base frequency? Can anyone explain why there is so much time difference between different compilers?

Analyze c++ sol. correctly. its not O(NMK).

1 Like

You are right I computed order complexity wrong… its O(nm) or O(mk) or O(n*k) whichever two among n,m or k are highest.

1 Like

Yes! Now you got it right.