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

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

How to keep doing when one feel severely devastated by chronic rating decrease and at the same time determined to raise it up?

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

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

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

I have not find any editorial of this 345A - Expecting Trouble . Can anyone please explain how to solve this ?

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

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

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

My observation is : Let an array A has length n and a subset of A is B. Now, if B has length k then it appears also in other 2^(n-k) subsets of array A.

So I used a 2d dp dp[i][j] which denotes if I take elements upto i then how many subsets have remaining sum j. And the ans is dp[n][0].

Base case is when i >= n then if the remaining sum is 0 that means we got a subset having sum S. Now we have to return in how many other subsets the current segment belongs. So if remaining sum = 0 then I returned pow(2,n-k) otherwise 0;

I thought this is the correct approach. Please correct my approach. I don't understand why it is not working.

Problem Link

My Code

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

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

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

In this 615D - Множители after analyzing some cases, I saw that,

If a number n = p1^a * p2^b * p3^c.

Then for the answer, the contribution of each prime is something like -

Let that , calculating the contribution of p1 --->

x = (a * (a+1) )/2;
y = (b+1)*(c+1) [ That is , how many divisors are there without the prime p1]

z = x*y
so the contribution of p1 is  p1^z

To calculate y , I had to use two loops. And got TLE 86303876 . How to optimize this portion?

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

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

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

I have been doing cp for 2 years . I admit that I have not pushed me harder. But right now when I have realized that I should have , I am blank. Basically I am facing stuck situation and disbelief in me what I have made over time. But I want to bounce back harder. But somewhere in me I cannot believe that I can do.

Does anybody face these , but later bounced back to some extent ? More generally , what do you think that what mindset or what made you to keep doing even after you are seeing that you are a Failure ?

What do you think what made you to be better from a very low situation ?

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

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

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

Given a string S. How many permutations of string s is lexicographically smaller than S . If S = "cda" answer will be 3 . And the strings are {"acd","adc","cad"}.

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

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

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

I am good for nothing . I cannot do a single thing daily that will boost my confidence . I make mess. I am messmaker .

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

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

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

In this 316E3 - Summer Homework how to perform 2nd and 3rd type query with segment tree ? Thanks in Advance.

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

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

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

766C - Mahmoud and a Message . I thought it to be a variation of stars and bars and so implemented 83511343. But got WA in test case 6. It is because I thought longest substring over all the ways would be minimum of all ai . I understood my mistake . Now , I saw the editorial , it was dp solution . Can anyone please explain it clearly ? Thanks.

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

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

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

In this 294C - Shaass and Lights I do not understand clearly what to do next. I have figured out that if there are n off lights between two on lights , number of ways to turn them on is 2^(n-1) . And for consecutive off lights having only one adjacent on light can only be turned on in one way. In the third sample test case lights from 5 to 7 can be turned on in 2^2 ways . And lights from 1 to 3 can be turned on in 1 way. Also, lights from 9 to 11 can be turned on in 1 way. So answer will be X * 1 * 4 * 1 . Now how to find this "X" ??

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

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

Автор LIFE_GOES_ON, история, 4 года назад, По-английски
  • Проголосовать: нравится
  • -11
  • Проголосовать: не нравится

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

Please anyone help me with this 98A - Помогите Василисе Премудрой . I do not understand how the solution of editorial is approached.

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

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

Автор LIFE_GOES_ON, история, 4 года назад, По-английски
  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится

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

In this atcoder problem,I do not understand how to approach. I am weak at expected value and probabilities . Please suggest me any good source to learn expected value from the beginning .

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

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

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

Can anyone make a good virtual dp practice contest ? Basically it will consist of several dp problems from easy to hard.

I have dp basic idea and I have learnt most known topics like knapsack,coin change,lcs. Also I solved few problems.

But still I am not good at it.

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

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

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

Please anyone explain the proof of the editorial of 893E - Counting Arrays . Specially , how using the stirling number is satisfying the solution? In the solution , they calculated for every prime number of x separately and then multiplied.

I understand the calculation for negative elements part.

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

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

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

Here in this 1073C - Vasya and Robot my observations are -

1)If (abs(x) + abs(y)) < string_length then ans -1

2)If (abs(x) + abs(y)) > string_length and ((abs(x) + abs(y))-string_length)%2 != 0 then also ans -1

Then I was thinking like, okay only way can be binary approach or any tiring greedy approach. But none of these could not help to proceed. Because If I will use binary search, how can I increase or decrease the length.

Do not put any direct solution. Just hints or just let me know where my thinking is wrong?

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

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

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

Here in this CF problem my observations are —

1) There cannot be more paths than n-1

2)If you start going right from any cell , you cannot go upward or downward after its next cell. If the grids are -

A B C D E
F G H I J

You cannot go — A->B->G ....

or A->F->G->H->C...

But I do not know how to proceed further.

In the tutorial they said about calculating prefixes , suffixes . But how these gonna help in handling the time of visiting a cell?

Hey wait ! please help , I want to learn to solve 1600-1800 problems within contest time. So help me :p

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

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