codingkshatriya's blog

By codingkshatriya, history, 4 weeks ago, In English

MikeMirzayanov Problem 1183H - Subsequences (hard version) has difficulty rating of 1900, which is less than it's corresponding easier version 1183E - Subsequences (easy version) of rating 2000, and the only difference between them is the constraints, can you please look into it?

Read more »

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

By codingkshatriya, history, 7 weeks ago, In English

Given a binary array, convert all the elements to zero Array (array with only zeros) in minimum number of steps

In one step we can choose any 2 adjacent elements and flip them together, or you can choose the last or first element and flip that particular element alone.

Input : N ( 1 <= N <= 1e5) Array elements ( 0 <= a[i] <= 1)

Output : Minimum number of steps to convert the binary array to all zeros

Sample : [1,0,1] Anwer is 2 ( one possible way is choose the second and third elements, flip them and then choose the first and second elements and flip them)

Can anyone help me solve this?

Read more »

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

By codingkshatriya, history, 2 months ago, In English

Problem Link

I understand the entire solution except the part " The probability of reaching any particular green square is the same for all but the green square in the last row", I don't get it why the last row is any different?

My understanding of the solution : We take all the squares which are the extension of the diagonal of the removed rectangle part. We have to pass through one of these squares in order to reach the destination and once we get to these squares the probability of reaching destination is 1. Since there cannot be interesction between these paths, we individually find the probability of reaching each of these squares and add them.

Can anyone please explain how the last row is any different?

My code : https://ideone.com/FIGKWD (got WA)

Read more »

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

By codingkshatriya, history, 2 months ago, In English

Given an Array, find the maximum difference between the sum of elements in odd indices and even indices. To achieve this you can delete any number of elements from the array,after deleting the elements,the array will be re-numbered.

Example : 1 4 8 2 6

Upon deleting 1,4.

New array 8 2 6

Answer is 8+6-2 = 12.

Constraints : 1<=N<=1e5

Can anyone please help me solve this problem?

Read more »

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

By codingkshatriya, history, 9 months ago, In English

I read the editorial,but the last part,the "second way" is not clear,can anyone please help me out? 962E - Байтландия, Берляндия и спорные города

Read more »

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

By codingkshatriya, history, 9 months ago, In English

MikeMirzayanov Several of the old contests don't have solutions,and even some of the new ones like Codeforces Round #609 (Div. 2) don't have solutions.

Though the contestant is expected to implement the solution on his own after reading the editorial,but at times,when editorial isn't elaborate enough or if the contestant couldn't get the implementation part,a peek at the solution would be really helpful.

Though we can view other's submissions,but most of the code is not written for reading purpose,and the approach may be completely different from that given in editorial.

It maybe inessential for top coders,but for novices like me,it could be a boon.

Read more »

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