Comments

rananjay23 Can you please provide any blog where this observation : "In Palindrome, number of inversions would remain same" is proven formally or at least an inituition is given. Thanks in advance :)

Actually I did the exact same thing.

My assumption : If say at the ith position, none of the elements rom the set can be placed, then i can always place xor(A[1]...A[K-1]) ^ A[i] making the xor of 1st K elements 0.

Please correct me if I am wrong.

If my assumption is true, then can I add xor(A[1]...A[K-1]) ^ A[i] in the set for thr ith position as well ? If no, then can you kindly say why

On Noneqwrecursion trouble :(, 6 years ago
+1

These two helped me a lot during my initial days. You can give it a try. I hope you will get some help.

Operations start counting after the arbitrary throw.

No, it does not count. What hasn't been said is that out of all arbitrary throws, choose the one which will help you reaching a sum >= x faster(i. e., in less steps)

For eg, in the sample, we can throw 1(arbitrary throw) then rotate 90 degrees right to bring 5 on the top. Then again rotate the dice to bring 3 on the top. Thus making a sum of 8 (>= 7) inn 2 steps. There are other ways as well.

Hint : Think Greedily ;)

Haha !! Never mind. I know that I haven't performed well this time but have certainly improved a lot from the last Hiring Contest(Codeagon). Will expect to improve afterwards. Thanks anyways :)

Is there any chances of getting a call after solving only 2 problems ?

Hello !

Consider OPERATION1, we have to find the maximum sub-array sum possible including an element i. This is easy if you know Kadane's Algorithm. For each index you have to store the largest sub-array sum you can achieve. Then, find out the maximum prefix achievable from index 0 till index i-1. Your answer is going to be that (maximum prefix sum till i-1) + (maximum sub-array sum achievable including element at index i(subarray should start from index i)).

Similarly, in case OPERATION2, your answer will be (maximum suffix sum till i+1) + (maximum sub-array sum achievable including element at index i(this time the subarray should end at index i))

NONE operation is just the Kadane's Algorithm

Python 3 Code : Maximum Subarray

On adyyyHelp with binary search!!, 6 years ago
+1

Basically you have to find Lower Bound of 22 as per your example is concerned. If you understand Java, then go through this. It consists of the code of Lower Bound in Java. For C++, google about lower_bound function and for Python google about bisect.bisect_left function. These are in-built functions.

Thanks a lot for the test case and for pointing out my mistake. Thanks a lot :)

I think the problem with this one is that it will time out. A normal dfs from X will visit all the path more than once( since more than one path can update the value of a node)

Can you please explain, how do you reduce the problem "Constrained GCD Array" to a graph problem. Are there any source from where I can get to read about it ?

Thanks. I had the same idea but unfortunately haven't been able to submit, so I needed a confirmation. Good to see that you got the exact same approach :)

On xormaximTricky combinotorics prob, 7 years ago
+6

hi, even I appeared for the same contest. The maximum no. of factors for a number would be as big as 144 whose ans will not fit in the long range of some languages.

On darkshadowsDP on Trees Tutorial, 7 years ago
0

Thanks a lot :)

On darkshadowsDP on Trees Tutorial, 7 years ago
0

@hrithik96 it would be nice if you can provide your code for better understanding. Thanks in advance :)

But I think it will be tough to get through with languages like Python or JAVA(not sure for JAVA though)

Thanks a lot :)

But don't you think that this approach would time out as n<=10000 ?

Thanks for the solution, but I still have the following doubts : 1. Can you please explain the reccurence relation that you have used in your solution? 2. How come the time complexity turned out to be O(n^2) ? @balalaika

On flash_7Digit DP, 7 years ago
0

Thanks :)

On flash_7Digit DP, 7 years ago
0

In the problem "Investigation" whats the logic behind taking the max remainder as 90 only? you have defined the dp states as dp[90][2][90][90]. why 90 ?Target2018

LOL XD I also missed it. Thanks bro

For <<>> if i choose 2nd character('<') then the string will become <>> as choosing < will delete its preceding character. Now i can choose the first occurence of '>' which will delete the last character. The string becomes <>. Now delete any one of the characters will make it a good string. So there's only one deletion. How the ans is 2 and not 1? Please correct me if I am wrong

why does this solution gets TLE whereas this solution gets Accepted?

Thank you. Just saw the AtCoder editorial of the similar problem. Well, tough to solve such problems untill you are aware of the technique. Anyways thanks for the clarification :)

Can anyone explain me the intuition behind the process in problem E ? Its hard to come up with such an idea

Actually I am not much accustomed to the syntax of c++ as I code in Python. If u could kindly explain what does g[i] stores, it will be helpful for me. Is g[i] a vector?

Can you please explain your idea ? I am not getting it

Bashca can you please explain how does this code has a time complexity of O(n). I am especially confused with the 2nd for loop that you have used after clearing the vector s. It has a nested for loop that runs from 1 to g[i]. If I am not wrong, g does store the index of the 1st minimum of each element in the array.

Wow.. really...Thanks a lot :) learnt a new thing today

Can you please explain how the complexity turns out to be O(n+mlogn) ? What I was thinking that for each of the element in the array we have to find the segments in which they fall and use lazy propagation to update them. So doesnt that turns out to be O(nm + mlogn) ?@pajenegod