Apricot Harvest
InterviewTime limit2sMemory limit1024 MB
Count all square sub-tables of the n by m grid whose sum is less than S, over every square size.
- Level
Easy3 of 10
- Topics
- Prefix sum, Brute force
- Solved
- No attempts yet
Statement
An table is filled with numbers. The king set a value , and every square on the field must have a harvest of at least . A square may consist of a single tree. King Briko I doubted the agronomists' report and asked for the number of squares that fail this criterion, that is, squares whose sum is less than .
Input
The first line contains three integers , , : the dimensions of the experimental apricot field and the value set by the king. Next come lines with numbers each, where is the number of apricots on the tree in row , column (; ; ).
Output
Print a single number: the count of squares where the harvest criterion is not met.