### Tech_Tricks_Master's blog

By Tech_Tricks_Master, history, 2 days ago, ,

Submission ID: 66585414 Problem : 1201/C C. Maximum Median

I am first calculating that for median to be ar[i], can we go there by swapping? Once done, all elements in second half of array are equal and i am still left with k, its easy to increase median by increasing all elements by 1 each. Please tell if this approach is fine or not, Getting WA at test case 6

• +9

By Tech_Tricks_Master, history, 3 days ago, ,

MIKE AND INFINITE GRID Mike and his friend are playing a game in the first quadrant of x-y plane. They have a toy car, which is initially placed at position (a, b). A player who can place it at position (p, q), where p<a and q<b, will win the game. In a move, a player can move this car from position (x, y) to:

A position (x',y), such that p <= x' < x. A position (x,y'), such that q <= y' < y. A position (x-k,y-k), such that 0 < k <= min(x-p,y-q).

# Mike starts the game and both the players play optimally. Find the winner of the game.

I understand the question reduces to two piles with A,B coins and players can remove any number of coins from individual stack and can remove k coins from both where k<=min(A,B)

• +3

By Tech_Tricks_Master, history, 3 weeks ago, ,

How important is lazy propagation in competitive programming? It takes me a lot of time to implement it. How do i get to know weather it is required or not by looking at the constraints? I mean, what is the complexity of a algorithm with and without it?

• -24

By Tech_Tricks_Master, history, 7 weeks ago, ,

When we have question to find a number given a condition between L,R we do fun(R)-fun(L). When we need to find a number with a max number between L,R we maintain 2 tight conditions. What do we do when we need to find kth largest between L,R given a condition? How do i account for that K ?