Need Hint On This Problem

Pages: 1... 34567
closed account (jy6DLyTq)
I M READY TO GIVE NMNMX/EQUILBR 100 POINT SOLUTION IN EXCHANGE OF 100 POINT GEARS SOLUTION
@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
closed account (jy6DLyTq)
M READY TO GIVE NMNMX/EQUILBR 100 POINT SOLUTION IN EXCHANGE OF 100 POINT GEARS SOLUTION
i can give u people pseudo code for all first 5 questions all i need is 100%ac pseudo code gear.
@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....
please help with how to calculate NMNMX.
i am getting wrong answer for second subtask
@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
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!!
Hello,guys i am unable to find relation for nmnmx problem can anyone help a little bit.
closed account (jy6DLyTq)
take nmnmx 100 point solution in exchange of gears full ac solution
no....u can change value atmost one time
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!!
I too am getting 10 pts with NSA brute work...how are ppl getting 30 pts?
@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
@hii yes i got 100
i guess that should be fine...
PM me ur code i ll see if i can optimise a bit
@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.
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).
@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
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