2020's blog

By 2020, history, 5 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • +15
  • Vote: I do not like it

By 2020, history, 5 years ago, In English

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

Full text and comments »

Tags #dp
  • Vote: I like it
  • +16
  • Vote: I do not like it

By 2020, history, 5 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By 2020, history, 5 years ago, In English
  • Vote: I like it
  • 0
  • Vote: I do not like it