X-Sum Codeforces Solution | Codeforces Problem Solution 2022
Timur's grandfather gifted him a chessboard to practice his chess skills. This chessboard is a grid with rows and columns with each cell having a non-negative integer written on it.
Timur's challenge is to place a bishop on the board such that the sum of all cells attacked by the bishop is maximal. The bishop attacks in all directions diagonally, and there is no limit to the distance which the bishop can attack. Note that the cell on which the bishop is placed is also considered attacked. Help him find the maximal sum he can get.
The first line of the input contains a single integer () — the number of test cases. The description of test cases follows.
Most Similar Words Codeforces Solution
The first line of each test case contains the integers and (, ).
The following lines contain integers each, the -th element of the -th line is the number written in the -th cell of the -th row
It is guaranteed that the sum of over all test cases does not exceed .
For each test case output a single integer, the maximum sum over all possible placements of the bishop.
Join Now for Solution:-
No comments:
Post a Comment