Jul 13, 2018 at 4:06pm Jul 13, 2018 at 4:06pm UTC
@invincible200 what is your approach for finding number times for each index
Jul 13, 2018 at 7:37pm Jul 13, 2018 at 7:37pm UTC
google modular exponentiation
Jul 13, 2018 at 7:47pm Jul 13, 2018 at 7:47pm UTC
we can repeat.
11227 could be a subsequence
Jul 13, 2018 at 7:49pm Jul 13, 2018 at 7:49pm UTC
@all use dp approach to calculate nCr
Jul 13, 2018 at 7:50pm Jul 13, 2018 at 7:50pm UTC
@utk911 yes i am pretty sure....test cases for subtask 1 must be weak
Last edited on Jul 13, 2018 at 7:50pm Jul 13, 2018 at 7:50pm UTC
Jul 13, 2018 at 7:59pm Jul 13, 2018 at 7:59pm UTC
@blackmamba
What is logic to reduce tle in no strings attached.
I have done following thing.
1. Change every element from a to z , then after changing checking how many elements are greater than it in succeeding array..
This make me to score 30 only...
Jul 13, 2018 at 8:01pm Jul 13, 2018 at 8:01pm UTC
@coder
Yes , ur approach is right ...
Jul 13, 2018 at 8:07pm Jul 13, 2018 at 8:07pm UTC
.@coder
Ur approach is correct to handle large nCr use dp..
I scored 100 using same...
Jul 13, 2018 at 8:10pm Jul 13, 2018 at 8:10pm UTC
@coder yup that was the tricky part.
try a little harder.
try printing different variables in your code to debug your code..
Jul 13, 2018 at 8:12pm Jul 13, 2018 at 8:12pm UTC
@blackmamba
Can u help me in NSA fir tke
Jul 13, 2018 at 8:14pm Jul 13, 2018 at 8:14pm UTC
ask ur queries in the NSA thread...i am out of messaging limit so cant help there
Jul 14, 2018 at 4:11am Jul 14, 2018 at 4:11am UTC
@decode
for(d = 1; d < n-1; d++)
{
result = (result%m * power(arr[d], c[arr[d]])%m)%m;
}
printf("%lld\n",result);
this is somewhat how used the multiplication and get 100......
Jul 14, 2018 at 4:50am Jul 14, 2018 at 4:50am UTC
see:
we know that
a^(m-n) = (a^m)/(a^n)
here 1/(a^n) can be written as inverse of a^n.
so , a^(m-n) = (a^m)*inverse( (a^n)).
hope this helps many of u.
Jul 14, 2018 at 6:55am Jul 14, 2018 at 6:55am UTC
@blackmamba
Check your PM i have sent you my code for nmnmx
Jul 14, 2018 at 7:24am Jul 14, 2018 at 7:24am UTC
@chelpme because he ncr part goes in power!!! by euler totient (a^b)%m=(a^(b%(m-1)))%m...so that is wht take modulo with m-1 for nCr part
Jul 14, 2018 at 7:35am Jul 14, 2018 at 7:35am UTC
@all guyz dont contact me through PM....i have posted all the necessary details to solve NSA and NMNMX problem in the respective forums....go through them and i wont be of any help more than that
Jul 14, 2018 at 7:45am Jul 14, 2018 at 7:45am UTC
@Wasp i have optimised ur code a bit...check PM