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

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

I am solving some string problems and recently encountered this problem Text Editor.

I am creating a new string and then I am calculating the Z array for that string. I am getting WA, and since it's a GYM problem, I am not able to know whether I am looking in the right direction.I can not find any Editorial for the same. Can you provide some idea to solve it? The link to my Solution.

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

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

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

Given an array of n integer elements. At a single moment we can delete a subarray if every element of this subarray is equal to one another. Doing so give us the points equal to (size of subarray)^2. We have to completely eliminate the array and also maximise the sum of points scored. How to solve this problem?

Score will change on the basis of order.

Eg:

Array = 11212

say it divided into 4 segments 11,2,1,2

If you choose order of segments as 3,(2,4),1. then score will be 1+4+4.

If you choose order of segments as 2,4,(1,3). then score will be 1+1+9.

amitgomi thanks for this example.

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

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

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

I found this problem on URI online judge. I am getting 30% WA when I set T=1 and TLE on all other cases. I am using Tries to solve it. Is there a different approach to solve this problem?

Problem Statement

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

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