Блог пользователя gjaiswal108

Автор gjaiswal108, история, 4 года назад, По-английски

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.

Source: https://www.geeksforgeeks.org/minimum-number-of-operations-to-convert-array-a-to-array-b-by-adding-an-integer-into-a-subarray/

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
  • Проголосовать: не нравится

Автор gjaiswal108, история, 5 лет назад, По-английски

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
  • Проголосовать: не нравится

Автор gjaiswal108, история, 5 лет назад, По-английски

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
  • Проголосовать: не нравится

Автор gjaiswal108, история, 5 лет назад, По-английски

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
  • Проголосовать: не нравится

Автор gjaiswal108, история, 5 лет назад, По-английски

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.)

Link for Problem 1077E

Link for TLE Solution

Link for AC Solution

Полный текст и комментарии »

  • Проголосовать: нравится
  • +7
  • Проголосовать: не нравится