Need Hint On This Problem

Pages: 1... 34567
Jul 12, 2018 at 7:15am
closed account (jy6DLyTq)
I M READY TO GIVE NMNMX/EQUILBR 100 POINT SOLUTION IN EXCHANGE OF 100 POINT GEARS SOLUTION
Jul 12, 2018 at 7:45am
@xander

yes, value of both n and k matters...

n=4;k=3; == 2^2 * 3^2
n=5;k=3; == 2^3 * 3^4 *4^3
n=6;k=3 == 2^4 * 3^6 * 4^6 * 5^4

n=4;k=4; == 2^1 * 3^1
n=5;k=4 == 2^3 * 3^4 * 4^3
n=6;k=4 == 2^6 * 3^9 * 4^9 * 5^6

check these for help
Jul 12, 2018 at 7:51am
closed account (jy6DLyTq)
M READY TO GIVE NMNMX/EQUILBR 100 POINT SOLUTION IN EXCHANGE OF 100 POINT GEARS SOLUTION
Jul 12, 2018 at 8:01am
i can give u people pseudo code for all first 5 questions all i need is 100%ac pseudo code gear.
Jul 12, 2018 at 8:13am
@vinn

I can tell u logic for 30 marks ...

Change each a[I] from a to z and take the sum everytime of its cost and how many elements are greater than it and check for minimum value every time ....

Minimum will be ur answer....
Jul 12, 2018 at 10:11am
please help with how to calculate NMNMX.
i am getting wrong answer for second subtask
Jul 12, 2018 at 10:27am
@hii each number appears a total of (n-1)C(k-1) times.
we need to find how many times that number appers at the coners and subtract that from the total!! hope that helps
Jul 12, 2018 at 11:02am
currently i am getting wa ans for subtask 2.
so i guess that means it wont give tle coz if it psses time limit it wont check answer!!
Jul 12, 2018 at 12:32pm
Hello,guys i am unable to find relation for nmnmx problem can anyone help a little bit.
Jul 12, 2018 at 12:38pm
closed account (jy6DLyTq)
take nmnmx 100 point solution in exchange of gears full ac solution
Jul 12, 2018 at 7:09pm
no....u can change value atmost one time
Jul 12, 2018 at 7:39pm
write down a few examples.
Calculate how many total times each index shows up(no matter in middle or on sides)(hint: it would be equal for every index)
Then calculate how many times each index shows up on boudaries in a subsequence(first or last).
Then subtract it from total and there u are!!
Jul 12, 2018 at 7:43pm
I too am getting 10 pts with NSA brute work...how are ppl getting 30 pts?
Jul 12, 2018 at 7:54pm
@all for NSA brute force if u are changing a particular value of string again and again and then changing it back, then dont copy whole string, just copy the index u want to change, that did the trick for me to get from 10 to 30
Jul 12, 2018 at 7:54pm
@hii yes i got 100
Jul 12, 2018 at 8:07pm
i guess that should be fine...
PM me ur code i ll see if i can optimise a bit
Jul 13, 2018 at 5:56am
@vinn O(n) is as good as it gets...Maybe you are judging the wrong complexity? Are you using dp?If not then try to use it.
Jul 13, 2018 at 6:53am
I had already solved NSA 100pts so here are few hints on NSA.
1) Use Fenwick Tree to count the pairs(S[i] < S[j])
2) There is no shortcut approach to know which char in string to be replaced, so you have to check for each char from [a-z].
3) Step 2 might look like brute force approach but try to achieve in O(n).
Jul 13, 2018 at 8:12am
@vinn

How u got O(n) ??????

Minimum to minimum it can be O(26*n) ..

My last part of subtask is still giving TLE .. in that complexity
Jul 13, 2018 at 11:18am
I have optimized the solution of NSA to O(n), but I am getting WA for tasks 1 and 2 of subtask 3.
I have used the dynamic programming approach to optimize my solution. I can't find the error. Please, can anyone tell me what possibly be wrong in my code?
Pages: 1... 34567