HDU 5386 Violence

Source: Internet
Author: User

Topic

is also a problem, unfortunately did not find this is a water problem, by the momentum of the Matrix was frightened, in fact, later made out of a lot of people, it should be thought that not so difficult. (two teammates into DP can not extricate themselves, do not want to change the plan).

Test instructions: Tells the initial matrix, the goal matrix, tells N steps (l column h row), then constructs the order, causes the change from the initial matrix to the goal matrix to be successful, the topic guarantees must have the solution (has the multi-solution, SPJ);

Analysis: The initial matrix is not useful (there is such a good hint on the field, more pity)

Initial matrix: Destination matrix: Three operations:

3 3 3 2 1 3 L 2 1 H 3 2

3 3 3 2 1 3 L 1 2

3 3 3 2 2 2

Backward push: Look at the destination matrix, the 1th and 3rd lines must be changed from one row or column, or three columns, three rows is possible, but there is no such option in the operation. That is, L 1 2 and H 3 2, ranked at the end, and then labeled the two rows of elements 0, because what was previously irrelevant, and eventually changed to 2 has been.

0 1 3

0 1 3

0 0 0

You can then find that the 2nd column can be considered to be all 1, exactly L 2 1.

Because there must be a solution, the others do not consider. Can traverse all operations 100 * 100 * 500 will not time out, this topic is a pity really ....

HDU 5386 Violence

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.