While I get to the organizers for editorials, here are the short solution outlines which you can refer to for solving the problem. 1.$\text{KCHESS}$Create a hash of positions which are near to king $3*3$ matrix. And after that check whether all the positions are attacking or not. a. $dp[i][j]$ represents the maximum sum that can be obtained by traversing a $‘L’$ shaped path formed from the coordinates, $(i,j)$, $(x,j)$ and $(x,M)$ where $(i<= x<=N)$ , for the submatrix with topleft corner at $i,j$ and bottom right corner at $N,M$. c. $dp[i][j]$ can be calculated as $dp[i][j] = mat[i][j] + max(dp[i+1][j],revCum[i][j+1])$(Base cases can be handled accordingly) d. After the dp and revCum have been calculated, the matrix can then be traversed and answer can be calculated using $ans=max(ans, revCum[i][j]+dp[i+1][j])$ 5.$CTOUR$ The problem can be solved using LCA and Kadane’s Algorithm on trees. Preprocessing steps: Profit from root to all the nodes  $profit[n]$. For calculating $LCA$ in $log(n)$. Using kadane’s algorithm (top down), calculate the max profit for each node, if we are at the node and go towards the root and come back  $up[n]$. Using kadane’s algorithm (bottomup) calculate the max profit for each node, if we are at the node and go towards downwards and come back  $down[n]$. Calculation steps: Every query can be answered in $O(log(n))$. There are three cases. a. If $LCA(A,B) != A or B$. Then we have only one choice going from $A$ to $LCA(A,B)$, then towards root to some extent and then to B. The total amount we can gain is $profit[A] + profit[B]  2*profit[LCA(A,B)] + 2*up[LCA(A,B)].$
This question is marked "community wiki".
asked 27 Oct '18, 16:59

____(guess who :p) = @vijju123 xD answered 27 Oct '18, 17:25

When will you guys publish the combined ranklist for Div1 and Div2? answered 27 Oct '18, 19:39

An interesting question arising from KCHESS would be to see if the knights can keep a noncheckmated king confined to an area of the board. If the king can get all but one of the knights behind him by a couple of squares, he can certainly never be driven back to the body of knights. answered 28 Oct '18, 08:04

answered 29 Oct '18, 20:13
