UV 437-The Tower of Babylon (longest Dag path)

Source: Internet
Author: User

From http://blog.csdn.net/shuangde800

Question: Click to open the link

Theme

There are n kinds of bricks with the length, width, and height of X, Y, and Z, each of which has countless.

Bricks can be built in different positions.

Brick A can be built on Brick B in some way. If and only when the bottom of a is longer and wider than B.

How high can I create?


Ideas

For an X, Y, and Z Brick, it can be placed in three middle positions.

(The first two are on the ground, and the last one is high)

X, Y, Z

X, Z, y

Y, Z, X

Record each posture into a brick with 3 * n fixed positions.

Create a graph. g [I] [J] = true indicates that the brick I can be built on the brick J, and vice versa.

Then, find the longest path on the Dag.



Code

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.