2018.10.15 Team Test T3

Source: Internet
Author: User

Test instructions

In a grid diagram, each time the deletion of an edge (U,V), and then ask if you can from the U to V, if possible, the output "HAHA", and delete the corresponding side of the situation given, otherwise output "Dajia", and delete the other side

Grid Chart Size <=500

1. By deleting an edge, it is equivalent to connecting the blocks on both sides of the side.

So I thought about it and looked it up.

2. When the two vertices are not connected after the deletion:

That is, block A and block B are already in the same unicom block before the edge is deleted.

Another scenario:

That is, at the edge of the boundary is deleted, it can be seen as a block B and the block number 0 Unicom

Positive solution:

Use and check set to maintain the connectivity of each block, if the two blocks in the same set before the deletion, then two points can not be connected after the deletion, otherwise it will be able to unicom

2018.10.15 Team Test T3

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.