Subsequence product !!! NMNMX - NO MINIMUM NO MAXIMUM

Pages: 1234
Jul 13, 2018 at 4:06pm
@invincible200 what is your approach for finding number times for each index
Jul 13, 2018 at 7:37pm
google modular exponentiation
Jul 13, 2018 at 7:47pm
we can repeat.
11227 could be a subsequence
Jul 13, 2018 at 7:49pm
@all use dp approach to calculate nCr
Jul 13, 2018 at 7:50pm
@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:59pm
@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
@coder

Yes , ur approach is right ...
Jul 13, 2018 at 8:07pm
.@coder

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

I scored 100 using same...
Jul 13, 2018 at 8:10pm
@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
@blackmamba

Can u help me in NSA fir tke
Jul 13, 2018 at 8:14pm
ask ur queries in the NSA thread...i am out of messaging limit so cant help there
Jul 13, 2018 at 8:15pm
@coder yes
Jul 14, 2018 at 4:11am
@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
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:46am
@venkykiller
same here
Jul 14, 2018 at 6:55am
@blackmamba
Check your PM i have sent you my code for nmnmx
Jul 14, 2018 at 7:24am
@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
@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
@Wasp i have optimised ur code a bit...check PM
Jul 14, 2018 at 7:47am
@blackmamba '
it gave WA
Pages: 1234