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

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

binary search (l+r)/2 or (l+r+1)/2 i saw this on a topcoder article that one or the other will no give while loop but on some test cases both might not as can be seen in submission 76258234 is where i changed (r+l)/2 to r+l+1/2 from this submission 76258059 and my solution passed so how to decide which one will never give a while loop right now i just do it randomly one and if that doesnt pass i do other

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

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

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

There's a scientist named Brook who is interested in budding of cells. He has one container which initially contains only a single cell. Now Brook wants n number of cells in his container. So he can change the number of cells in container in 3 different ways -:

Double the number of cells present in the container.

Increase the number of cells in the container by 1.

Decrease the number of cells in the container by 1.

Now, all the above operations have different costs associated with them x,y,z respectively for above operations. Help brook in finding the minimum cost to generate n cells in the container starting from one cell Constraints 1<=n<=10^5 1<=x<=y<=z<=10^5

Output Format Output an integer denoting the minimum cost incurred to create n cells

Sample Input 5 2 1 3 Sample Output 4 i have been trying hard but cant get around what can work for this question

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

Теги #dp
  • Проголосовать: нравится
  • +16
  • Проголосовать: не нравится

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

https://codeforces.net/blog/entry/72358 not able to to understand explanation for 1269D specially this line "I claim that the Young diagram can be partitioned into domino if and only if the number of white cells inside it is equal to the number of black cells inside it."

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

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

Автор 2020, история, 5 лет назад, По-английски
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится