Bash Matrix Solution CodeChef

Bash Matrix Solution February Challenge 2021 A Bash matrix is a matrix with NN rows (numbered 11 through NN) and NN columns (numbered 11 through NN), where for each row rr and column cc, the cell in row rr and column cc (denoted by (r,c)(r,c)) contains one of the characters ‘U’, ‘D’, ‘L’ or ‘R’. Also See: February Long Challenge 2021 Solutions We can move in the matrix while treating the characters as … Read more

Shuffling Parities Solution September Challenge 2021

September Long Challenge 2021

Shuffling Parities Codechef Solution Chef is given an array AA consisting of NN positive integers. Chef shuffles the array AA and creates a new array BB of length NN, where Bi=(Ai+i)mod2Bi=(Ai+i)mod2, for each i(1≤i≤N)i(1≤i≤N). Find the maximum possible sum of integers of the array BB, if Chef shuffles the array AA optimally. Also See: September Long Challenge 2021 Solutions Input Format The first line of the input contains a … Read more

Covaxin vs Covishield Solution September Challenge 2021

September Long Challenge 2021

Codechef Covaxin vs Covishield Solution There are two types of vaccines available: Covaxin and Covishield. A black marketeer has XX Rs and wants to buy as many vaccines as possible. Due to the black marketing concerns, government has enforced the following policy: ithith dose of Covaxin costs a+(i−1)⋅ba+(i−1)⋅b coins for every i≥1i≥1. ithith dose of Covishield costs c+(i−1)⋅dc+(i−1)⋅d coins for every i≥1i≥1. The values of … Read more

Treasure Hunt Solution September Challenge 2021

September Long Challenge 2021

Codechef Treasure Hunt Solution Chef lives in an N×MN×M grid. He is currently participating in a treasure hunt, and has two items left to find. Chef knows that the Manhattan distance between the cells containing these two items is exactly kk. He wants to know, in how many different pairs of cells can the two items be present? … Read more

Codechef Minimize Digit Sum Solution

September Long Challenge 2021

Minimize Digit Sum Solution September Long Challenge 2021 Let f(n,B)f(n,B) be the sum of digits of the integer nn when written in base BB. Given QQ queries, each consisting of three integers n,ln,l and rr. Find the value of BB corresponding to which f(n,B)f(n,B) is minimum for all l≤B≤rl≤B≤r. If there are multiple such values, you can print any of them. Also See: September Long Challenge 2021 Solutions Input Format … Read more