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

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

Hello, I have been trying to solve the following problem which was a part of Topcoder SRM 696 Div1 Easy.

I am unable to find a editorial for the problem and I am not able to solve it. Can someone please tell me how to approach this problem ?

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

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

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

Hello all, I am trying to solve the problem Sausage Maximization. I am solving it using the approach mentioned in the editorial for the question.
I am getting Wrong answer on Test 33 on the following submission. Submission
I have tried a lot of test cases, but I am unable to find any error in the implementation. It would be really helpful, if someone could point out some error in the implementation,

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

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

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

Hello all, I have tried unsuccessfully to solve the problem Bear and the Polynomials

I am unable to understand the editorial posted for the problem, can some one please post their approach to solve the problem, or explain the approach discussed in the editorial clearly.

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

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

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

Hello All,

I have been trying to solve the problem HomeTask, but I am unable to devise my own solution, nor I am able to understand the approach discussed in the problem.
Here is the problem Hometask
It would be really helpful, if somebody could tell me how to solve this question or maybe elaborate on the approach given in the editorial.
Thank you

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

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

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

Hello all, I am trying to understand the algorithm mentioned in the editorial for the following problem
Zuma Here is its editorial editorial.

In the case, when the ith color matches with the kth color in the range [i...j], shouldn't we be doing

D[i][j] = D[i+1][k-1] + D[k+1][j] + 1, instead of
D[i][j] = D[i+1][k-1] + D[k+1][j]
?

This is because, we have to destroy the matching characters in ith position with kth position also, which will take 1 step extra.

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

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

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

Hello, in this article I would be telling an alternative solution to the problem 580B - Kefa and Company

Most of the solutions , which I have seen use Binary search to solve the problem after sorting of course, so the overall complexity of the solution is O(nlogn) + O(nlogn). I am discussing approach with the complexity of O(nlogn) + O(n). Here , the first O(nlogn) is due to sorting. So, after sorting there is a great improvement in the algorithm complexity. My approach is similar to Z-algorithm for string matching.

Just like Z-algorithm, we maintain a Z[i] array which will contain two things (ie a pair<int,int>), first the maximum index till which we can invite friends starting at ith position and second the total cost of doing so.

Now, while iterating over the entire array, we check whether the current index is less than the Z[i-1].first, if it is so then we immediately know that Z[i].first is at least Z[i-1].first and we iterate from there and update the Z array.

For any clarification, please see my following submission 13210753

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

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