Farmer John's pasture can be regarded as an N x N grid(1<=n<=500)of square "cells" of grass(picture a huge chessboard).
Due to soil variability,the grass in some cells is greener than in others.Each cell(i,j)is described by an integer level of greenness G(i,j),rangeing from 1...200
Farmer John wants to take a photograph of a rectangular sub-grid of his pasture.He wants to be sure the sub-grid looks
sufficiently green, but not ridiculously green,so he decides to photograph a sub-grid for which the minimum value of G is exactly
100.Please help him determine how many different photographs he could possibly take.A sub-grid can be as large as the entire
pasture or as small as a single grid cell(there are N**2 *(N+1)**2/ 4)different sub-grids in total--note that this number might be too
large to store in a standard 32-bit integer,so you might need to use 64-bit integer data types like a "long long" in C++)
input format
The first line of input

这是一篇关于USACO2021竞赛中Silver级别第三题的解析,题目要求在N*N的草地上找到所有绿色度最小值为100的矩形子区域,总数可能超过32位整数范围,需要使用64位数据类型。文章讨论了如何确定满足条件的不同矩形数量,并提供了C++和Python的代码示例。
最低0.47元/天 解锁文章
307

被折叠的 条评论
为什么被折叠?



