any square piece of the stand, I. e. any set S(i0,j0,k)={ci,j | i0≤i
Correct answer Will be upvoted else downvoted.
subsquare is any square piece of the stand, I. e. any set S(i0,j0,k)={ci,j | i0≤i<i0+k,j0≤j<j0+k}S(i0,j0,k)={ci,j | i0≤i<i0+k,j0≤j<j0+k} with 1≤i0,j0≤n−k+11≤i0,j0≤n−k+1.
Kostya actually doesn't have the foggiest idea the number of tiles he wants, so he considers the subsquares of every conceivable size. He doesn't need his restroom to be excessively bright. Assist Kostya with counting for each k≤nk≤n the quantity of subsquares of size k×kk×k that have all things considered qq various shades of tiles. Two subsquares are considered unique if their area on the stand is unique.
Input
The main line contains two integers nn and qq (1≤n≤15001≤n≤1500, 1≤q≤101≤q≤10) — the size of the stand and the cutoff on the quantity of particular tones in a subsquare.
Each of the following nn lines contains nn integers ci,jci,j (1≤ci,j≤n21≤ci,j≤n2): the jj-th integer in the ii-th line is the shade of the tile in the cell (i,j)(i,j).
Output
For each kk from 11 to nn print a solitary integer — the quantity of subsquares of size k×kk×k without any than qq various shadings.
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)