HDU 4127 * Search

Source: Internet
Author: User

Test instructions

For an 8x8 matrix, there are 6 colors to choose from, each time can only change the top left corner of the color, the result is that all points connected with the point is dyed that color, asked at least several times can be the whole picture to dye the same color.

Solution:

A * search, the valuation function is, if you choose the color K, you can have how many lattice in this operation is added to the connected block, if the value of 0, then cut off.

VIS[I][J] may be 0 1 2 for 1 means that the point is in the connected block, and 2 means that the point is adjacent to the connected block, otherwise 0.

For the current situation, we can find out how many more colors are available outside of the connected block, and the minimum number of operations may be required to accomplish this. It's just possible. We set the number of outer-block colors in the initial diagram to the minimum number of operands that could be done. Based on this operand, we are going to verify that it is feasible. If it is not feasible, the number +1, then to verify. Until a workable solution is found.

 

Pending repair.

HDU 4127 * Search

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.