Deepak And prmes 2 Please Help Me To Debug the Problem
firstly, since b can be upto 1000000000, so you canβt iterate from i=0 to i<=b as you did in line no. 49. Iterate it till sqrt(b), some testcase would pass. Also try to implement segmented sieve properly.
i have done the changes but still it is showing TLE
@amangoel987357
your code is giving wrong ans when a=1. Consider this testcase
1
1 6
ans should be β2, 3, 5β but your code is giving β1, 2, 3, 5β. Simply if(a==1){ pp[0]=0; } after line no. 61. Now your code passes all testcase except one which give TLE.
For TLE optimise your segmented seive.
I hope Iβve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.