Simba is a very well-known lion in the jungle. But there is still one thing he is afraid of that is big rhinos. He always tries to avoid them. Simba's city can be represented as an N x N grid. Each...


Simba is a very well-known lion in the jungle. But there is still one thing he is afraid of that<br>is big rhinos. He always tries to avoid them. Simba's city can be represented as an N x N<br>grid. Each cell of the city can either contain rhinos or not. Simba knows that K cells of the<br>city are dumps. If a cell is a dump, then each diagonal that contains this cell is full of<br>rhinos. Two cells with corresponding coordinates (i, j) and (x, y) are on one diagonal if<br>either x + y equals i +j or x - y equals i - j.<br>You are given integers N and coordinates of K dumps. Create a python program to find<br>the number of cells which are free of rhinos.<br>Test Case 1:<br>1<br>32<br>1 2<br>32<br>Output:<br>7<br>

Extracted text: Simba is a very well-known lion in the jungle. But there is still one thing he is afraid of that is big rhinos. He always tries to avoid them. Simba's city can be represented as an N x N grid. Each cell of the city can either contain rhinos or not. Simba knows that K cells of the city are dumps. If a cell is a dump, then each diagonal that contains this cell is full of rhinos. Two cells with corresponding coordinates (i, j) and (x, y) are on one diagonal if either x + y equals i +j or x - y equals i - j. You are given integers N and coordinates of K dumps. Create a python program to find the number of cells which are free of rhinos. Test Case 1: 1 32 1 2 32 Output: 7

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here