Comments

https://github.com/vd-coder/Codeforces-Solved-Problem-Analyser

You can try this, Implemented it for personal use

My solution for F is slight different from others, I binary searched on time, and got amount of fire and water. Now if any of these is greater than sum, this time works. Else, I try to fill knapsack of fire in most optimal way, (by optimal I mean, filling it in such a way that it has least remaining space possible) and check if remaining sum can be filled in water knapsack. Similarly, tried to fill water knapsack in most optimal way and check if remaining can be filled in fire knapsack.

Here is link to submission

In D, I thought it is as graph problem, connecting (i,j) to 1. First cell which is left to it and have same character 2. First cell which is right of it and have same character 3. First cell above it and have same character 4. First cell below it and have same character

After making these connections, I just traversed the formed graph and count size of components. If size >1 , cells in that component should be removed. This causes TLE on some cases and WA on some.I don't know what's wrong in this

Alternative solution for D: we can compute maximum distance of some node for each node in a tree, now if k>maximum distance between any two nodes , number of connected components is n. let number of nodes with maximum distance be x. then for k=x, answer is n-x+1. Now iterate from x to 1 , answer for k=y is n-(freq[y]+freq[y+1]+freq[y+2]......+freq[x])+1,where freq[x] denotes number of nodes with maximum distance equal to x. link to submission

+9

Never thought 69 would hurt so much

On vd__coderNeed help in a problem, 4 years ago
0
On vd__coderNeed help in a problem, 4 years ago
0

Auto comment: topic has been updated by vd__coder (previous revision, new revision, compare).

I thought C in some different way, I thought in direction of reverse of given operation and making and converting B->A. The reverse operation can be stated as: If Bi and Bi+1 are equal, replace Bi with any integer in [1,N]. This lead to conclusion that A should contain some cyclic rotation of compressed B as its subsequence.

For E I accidentally solved it in a different way than others told. The part till possible answers are divisors of total sum is same, for checking validity of a divisor(g), let m be number of elements that are to be increased,then we can conclude that m=(sum of remainders obtained when divided by g)/g and required moves are total sum of remainders-sum of these m remainders, now we are left with to find largest sum of size m, this can be done by taking m largest remainders.

Link to submission:

0

Div2 C1 and C2 have Dp as one of the tag, can someone suggest how to use dp in this problem?

Can you please elaborate a bit

Is it possible to solve D if the randomness condition is removed?

Count me in

On vd__coderNeed Help, 4 years ago
0

, got it, since we can go only right and down, when plotting grid as a graph, we can't go to a cell that is rejected above, This was the point I missed.

On vd__coderNeed Help, 4 years ago
0

Say i use bfs, (1,1) as root as then subsequent graph is formed , from a node (i,j) i would go its that child which has smaller character, but in case those characters are same, i would be requiring to return string by those cells with same characters. wont this be n^3??

It would be really great if you can explain in some detail

On vd__coderNeed Help, 4 years ago
0

Auto comment: topic has been updated by vd__coder (previous revision, new revision, compare).

0

In Div1 B ,I am implementing the same logic as editorial but getting tle here is submission link 160036330

In problem F,as per the equation in editorial,for each l in prefix array there would be value for right index in prefix array, given by p[r]<p[l-1]-s,so cant this this be implemented with a method of finding next greater element,with a little modification?

I don't understand that why are you going to 8 from 9 and not on 7, I mean we can use a crystal to change the state at height at 7 and then use a normal operation, I UNDERSTAND THAT YOU WROTE IT LONG TIME AGO, BUT PLEASE TRY TO EXPLAIN