Can someone tell me why in this problem sample output is 2 .
As one of the possible scenarios can be
1st user votes for 5
2nd user votes for 5
3rd user votes for 4
4th user votes for 5
So, it could be 4 .
Actually the question asks for the minimum number of fake users needed
How to solve EAZYE ?
I think instead of X<=1 here X<1 should have been . Because why are you returning if X==1 , the answers could be got by not going with the X which has its value as 1.
For some reason it returns 29 intead of 36 on doing this.
It runs correctly now. Cant Submit because upsolving is still not open
I just swapped the position of EACH loop and if(P==p+1) statement
Thank you for your time. I appreciate it. Hopefully, this should work correctly now.
N<=2^17 in that problem. (x-x1)(x-x2)…(x-xn) for n=3000000 would require a higher order root of 1 mod p to apply NTT
this blog has a quick solution in the comments but I will be posting an official editorial soon
Please shift the problems to practice section.
I also used the same logic, but I was getting a TLE. My submission link: CodeChef: Practical coding for everyone
Here is my solution @cubefreak777 @aditya0412
line nos 76-94 is the brute force k^{p} implementation.
check lines 44-63 for my fairly simple dijkstra implementation, just in case there you have made some silly mistake there
I’ve been trying to compare my solution to yours and cant really find the error. Could you take a look at it? Sadly, overflow wasn’t the cause of this problem. ![]()
Amazing Approach.
Ok thanks
It’s showing your code’s runtime is 1.06 sec but the time limit is only 1 sec
That’s because CodeChef uses adaptive limits for different languages - it’s not like CodeForces where your algorithm may fail due to use of a slower language.
Are the test cases for Messi and his Permutations problem weak ?
https://www.codechef.com/viewsolution/45022231 this solution passed tests but gives wrong answer for the input 5 3 and all the inputs where n>y