Topcodersrm 630 (500 floyed brute force _ builtin_popcount ())

Source: Internet
Author: User

Question: Give N points to ensure graph connectivity, give the distance between points, and find the most point. The distance between these points is the same.

Analysis:

The code below is the first great God in our room. It is very concise and I have the same idea as him, but I don't know where the error is.

The idea is brute-force enumeration. There can be a maximum of 10 points. Use floyed to calculate the distance between each two points, and then use bitwise to perform brute-force enumeration,

Enumerate whether each vertex is added in, and use set to add the distance between each vertex. If the distance is unique, all the distance between the vertex is the same,

Then, use _ builtin_popcount () to calculate the number of 1 points in the binary, that is, the number of points added and the maximum value is obtained.

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.