Dominater069's blog

By Dominater069, history, 11 months ago, In English

We invite you to participate in CodeChef’s Starters 191, this Wednesday, 18th June, rated for 6 stars (i.e. for users with rating < 2500).

Time: 8:00 PM — 10:00 PM IST

Joining us on the problem setting panel are:

Written editorials will be available for all on discuss.codechef.com. Pro users can find the editorials directly on the problem pages after the contest. The video editorials of the problems will be available only to Pro users.

Also, if you have some original and engaging problem ideas, and you’re interested in them being used in CodeChef's contests, you can share them here. Hope to see you participating.

Good Luck!

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

»
11 months ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

Contest starts in ~25min.

»
11 months ago, hide # |
Rev. 2  
Vote: I like it +19 Vote: I do not like it

My thoughts on Grid Path (Hard):

Let $$$\text{cost}(i, j)$$$ denote the cost of moving the first $$$j$$$ (or the last $$$j$$$) '1's in the $$$i$$$-th row to valid positions.

We observe that:

  • $$$\text{cost}(1, j+1) - \text{cost}(1, j)$$$ is non-decreasing, and
  • $$$\text{cost}(2, j+1) - \text{cost}(2, j)$$$ is non-increasing.

This implies that the total cost function is convex.

I used a Fenwick Tree combined with binary search to maintain it, and applied ternary search to find the optimal answer.

Unfortunately, I didn't handle the edge cases properly. And the complexity of $$$O(q \log^3 n)$$$ only passes the first 7 test cases. I believe that direct binary search in data structure can be $$$O(q \log^2 n)$$$.

  • »
    »
    11 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    i also tried this approach ... i made it very complex .. 4 bit ..one for positon in each row and then also for number of ones..then i needed ordered statistic for finding the index with k ones in the left. Not Able to debug :{...can u share your code My code...

»
11 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

what could be the rating of the problem ( Add 1 or 2 ) comparing with cf ?

»
11 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Can anyone please drop the sudocode for problem add 1 or 2

»
11 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

is there any greedy solution for coloured array ?

»
11 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

I really like the way problems are described.. No nonsense and stories and to the point.. Nice problems..

»
11 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

loved the problem Grid Path (easy) :)