Whenever I'm stuck on a CSES problem, I know ARS will be there with an easy explanation! Thank you for making CSES video editorials. (Also I believe you're secretly a master on CF)
Brilliant explanation! I'm really grateful that you put that extra effort to explain how to use modulo during division, others would explain the problem and skip the modulo part assuming we already know. Thanks to you now I know the right way to take mod during division!! XD
Bro this question look very simple by its name but this approach is little hard to think... How you think and understand these solutions and concept.. Your explanation is amazingggg 😍
It is perfectly normal that this approach seems a bit hard. The most important thing in cp is to enlarge one's database of problems and techniques. What you learned from this problem can come in handy in similar situations, and be sure that all competitive programmers learn from others to a great extent and very rare are the occasions when one comes with smtg truly original.
I have one doubt- Formula of calculating sum of n numbers is (n*(n-1))/2. Then when we calculating sum of (j-1) values, why we are doing (j*(j-1))/2 , instead of (j-1 * ((j-1)-1))/2 ?????
Bro can you give some hints for this question We are given N numbers in an array, find a minimum number (say P) which is co-prime with all numbers of array
Whenever I'm stuck on a CSES problem, I know ARS will be there with an easy explanation! Thank you for making CSES video editorials. (Also I believe you're secretly a master on CF)
Thank you so much! I really appreciate your support!
Brilliant explanation! I'm really grateful that you put that extra effort to explain how to use modulo during division, others would explain the problem and skip the modulo part assuming we already know. Thanks to you now I know the right way to take mod during division!! XD
So glad i could help, it's people like you who make this effort worthwhile!
Bro this question look very simple by its name but this approach is little hard to think... How you think and understand these solutions and concept.. Your explanation is amazingggg 😍
It is perfectly normal that this approach seems a bit hard. The most important thing in cp is to enlarge one's database of problems and techniques. What you learned from this problem can come in handy in similar situations, and be sure that all competitive programmers learn from others to a great extent and very rare are the occasions when one comes with smtg truly original.
Great explanation. Thank you!!
So Good!
superb!!!!
Thank you!
I have one doubt-
Formula of calculating sum of n numbers is (n*(n-1))/2.
Then when we calculating sum of (j-1) values, why we are doing (j*(j-1))/2 , instead of (j-1 * ((j-1)-1))/2 ?????
Actually the formula of calculating sum of n numbers is (n*(n+1))/2. For example sum up to 3 will be 6 but (3*2)/2 is only 3 whereas (3×4)/2 is 6
nice explaination
I know that this trick comes from The Harmonic Lemma but, does it have a known name or with which I can identify it?
This approach is giving TLE. Instead of multiplying with the modular inverse we can multiply with (MOD+1)/2
As you saw in the video! this approach got accepted! can you share your submission?
@@neatlystructured you calculate modular binary exponent every loop iteration which is constant so store it in variable and use it for each test case
what is the logic behind j= n/q+1 ?
Thanks!
you are very welcome!
Bro can you give some hints for this question
We are given N numbers in an array, find a minimum number (say P) which is co-prime with all numbers of array
I am not sure i understand this problem correctly because 1 seems to be an answer always. But i dont think that s what s required
@@neatlystructured bro here array of n elements are given.. It doesn't mean we have to find from 1 to n
@@neatlystructured yes problem is very confusing
@@competitiveprogramming316 can you share the link to the problem?
still i get tle in this question
Can you share your code please?
@@neatlystructured you calculate modular binary exponent every loop iteration which is constant so store it in variable and use it for each test case
take const ll mod=1e9+7 It might work