Using python programming develop the code for following:Tuzik is a very brave puppy. But there is still one thing he is afraid of - big black cats. He always tries to avoid them.Tuzik's city can be represented as an N x N grid. Each cell of the city can either contain cats or not. Tuzik 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 cats (all cells of this diagonal contain cats). 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. Please find the number of cells which are free of cats. Input: 1 3 2 1 2 3 2 Output: 5
Using python programming develop the code for following:Tuzik is a very brave puppy. But there is still one thing he is afraid of - big black cats. He always tries to avoid them.Tuzik's city can be represented as an N x N grid. Each cell of the city can either contain cats or not. Tuzik 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 cats (all cells of this diagonal contain cats). 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. Please find the number of cells which are free of cats.
Input:
1
3 2
1 2
3 2
Output:
5
Step by step
Solved in 2 steps with 1 images