LIFE_GOES_ON's blog

By LIFE_GOES_ON, history, 4 years ago, In English

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

Full text and comments »

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

By LIFE_GOES_ON, 4 years ago, In English

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

Full text and comments »

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

By LIFE_GOES_ON, history, 4 years ago, In English

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

Full text and comments »

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

By LIFE_GOES_ON, history, 4 years ago, In English

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?

Full text and comments »

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

By LIFE_GOES_ON, history, 4 years ago, In English

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 ?

Full text and comments »

  • Vote: I like it
  • -25
  • Vote: I do not like it

By LIFE_GOES_ON, history, 4 years ago, In English

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

Full text and comments »

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

By LIFE_GOES_ON, history, 4 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • -25
  • Vote: I do not like it

By LIFE_GOES_ON, history, 4 years ago, In English

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

Full text and comments »

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

By LIFE_GOES_ON, history, 4 years ago, In English

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.

Full text and comments »

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

By LIFE_GOES_ON, history, 4 years ago, In English

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

Full text and comments »

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

By LIFE_GOES_ON, history, 4 years ago, In English

If in this 1197D - Yet Another Subarray Problem range of m is m <= n , how to approach ?

Full text and comments »

  • Vote: I like it
  • -11
  • Vote: I do not like it

By LIFE_GOES_ON, history, 4 years ago, In English

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

Full text and comments »

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

By LIFE_GOES_ON, history, 4 years ago, In English

How to solve this 1313C2 - Skyscrapers (hard version) with segment tree ?

Full text and comments »

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

By LIFE_GOES_ON, history, 4 years ago, In English

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 .

Full text and comments »

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

By LIFE_GOES_ON, history, 4 years ago, In English

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.

Full text and comments »

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

By LIFE_GOES_ON, history, 4 years ago, In English

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.

Full text and comments »

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

By LIFE_GOES_ON, history, 4 years ago, In English

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?

Full text and comments »

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

By LIFE_GOES_ON, history, 4 years ago, In English

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

Full text and comments »

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