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

Автор Dominater069, история, 17 месяцев назад, По-английски

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!

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

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

Contest starts in ~25min.

»
17 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +19 Проголосовать: не нравится

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)$$$.

  • »
    »
    17 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

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

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

is there any greedy solution for coloured array ?

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

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