HBC24622智斗恶龙,枚举,离散化,广度优先搜索(BFS),搜索Brownie Slicing题解

一点都不欢乐 算法基础篇 53 0
想要检验自己的编程水平?来试试全网最全C++题库,让您在挑战中不断进步。
Bessie has baked a rectangular brownie that can be thought of as an RxC grid (1

Bessie has baked a rectangular brownie that can be thought of as an RxC grid (1 <= R <= 500; 1 <= C <= 500) of little brownie squares. The square at row i, column j contains NijN_{ij}Nij​ (0 <= NijN_{ij}Nij​ <= 4,000) chocolate chips. Bessie wants to partition the brownie up into A*B chunks (1 <= A <= R; 1 <= B <= C): one for each of the A*B cows. The brownie is cut by first making A-1 horizontal cuts (always along integer coordinates) to divide the brownie into A strips. Then cut each strip *independently* with B-1 vertical cuts, also on integer boundaries. The other A*B-1 cows then each choose a brownie piece, leaving the last chunk for Bessie. Being greedy, they leave Bessie the brownie that has the least number of chocolate chips on it. Determine the maximum number of chocolate chips Bessie can receive, assuming she cuts the brownies optimally. As an example, consider a 5 row x 4 column brownie with chips distributed like this: 1 2 2 1 3 1 1 1 2 0 1 3 1 1 1 1 1 1 1 1 Bessie must partition the brownie into 4 horizontal strips, each with two pieces. Bessie can cut the brownie like this: 1 2 | 2 1 --------- 3 | 1 1 1 --------- 2 0 1 | 3 --------- 1 1 | 1 1 1 1 | 1 1 Thus, when the other greedy cows take their brownie piece, Bessie still gets 3 chocolate chips.

HBC24622智斗恶龙,枚举,离散化,广度优先搜索(BFS),搜索Brownie Slicing题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: HBC24622智斗恶龙 枚举 离散化 广度优先搜索(BFS) 搜索Brownie Slicing题解