### gjaiswal108's blog

By gjaiswal108, history, 4 years ago,

How to solve this problem ?

Given two arrays A[] and B[] of length N, the task is to find the minimum number of operations in which the array A can be converted into array B where each operation consists of adding any integer K into a subarray from L to R.

PS: I came across this problem on gfg, but then realised that their solution is Wrong. It fails on the following case: A = {0, 0, 0}, B = {1, 2, 1} Output should be 2, but their code is giving 3.

Edit: there can be two variation of this problem:

1st — When K is a positive integer

2nd — When K can be any integer

There might be different solution for both. So answer by assuming each case.

• +52

By gjaiswal108, history, 4 years ago,

In ICPC India online round the 3rd problem was related to manipulation on line segments.I want to solve many more problem like this. Where can I find all the problems related to segments. If someone has list of these type of problems then please post the links in comment.

Edit: I already tried to search for this tag, but there is no such tag in problemset. That's why I posted here.

• +6

By gjaiswal108, history, 5 years ago,

Please add a feature to find out the list of all the div3 contests or div2/div1/educational contest links at a single page. It may further be improved by sort by date range(for example ,if I missed contests for few months then I am interested to find how many contests happened so that I can do that again virtually.)

• +127

By gjaiswal108, history, 5 years ago,

The thing we can do with priority queue, can also be done with multiset. Then what is the quality that's unique in priority queue? Can anyone give any example where multiset fails and only priority queue works?

• +4

By gjaiswal108, history, 5 years ago,

Getting TLE on using unordered_map, while AC on using map for problem E. Can anyone explain why??(I think unordered_map should be faster than map because its time complexity is O(1) for all operation.)