Our Codechef Campus Chapter Team (Netaji Subhash Engineering College) has been hosting Encoding for over a year and we do it almost every month in Codechef. We try to keep the questions balanced such that from newbies to pros , everyone find it educational.
We would really like to here from the community.
Any feedback is accepted. We will try to improve as well.
This is regarding the question GVR, can anyone explain me, CodeChef: Practical coding for everyone
How this solution got accepted under the constraints mentioned in the question?
This is because of very less no of primes were present in test case with higher value. This is the reason that many of you got AC even with O(NSqrt(N)), but it appears nearly equal to O(N). The perfect solution for this problem will be Miller Rabin Primality Test for checking prime, then its complexity in that case will be O(N*(lnN)^2)
The perfect solution for this problem will be Miller Rabin Primality Test for checking prime, then its complexity in that case will be O(N*(lnN)^2)O(N∗(lnN) 2)