Subsequence product !!! NMNMX - NO MINIMUM NO MAXIMUM

Pages: 1234
@invincible200 what is your approach for finding number times for each index
google modular exponentiation
we can repeat.
11227 could be a subsequence
@all use dp approach to calculate nCr
@utk911 yes i am pretty sure....test cases for subtask 1 must be weak
Last edited on
@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...
@coder

Yes , ur approach is right ...
.@coder

Ur approach is correct to handle large nCr use dp..

I scored 100 using same...
@coder yup that was the tricky part.
try a little harder.
try printing different variables in your code to debug your code..
@blackmamba

Can u help me in NSA fir tke
ask ur queries in the NSA thread...i am out of messaging limit so cant help there
@coder yes
@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......
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.
@venkykiller
same here
@blackmamba
Check your PM i have sent you my code for nmnmx
@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
@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
@Wasp i have optimised ur code a bit...check PM
@blackmamba '
it gave WA
Pages: 1234