[Puzzle + Summary]20151015 Division

Source: Internet
Author: User

1. Preface

Cross-Test the four-shot-from the CAB division (which means that yesterday was mine). I feel that the quality of today's topic is very high, the knowledge involved is very comprehensive, although it is based on the division of the rule. Violence is not all right, alas.

2. Color Fence Paint

Probably test instructions: give n a height of h[i] fence, each can be horizontal or vertical to a row or a row of coloring, each fence small lattice can only be painted once, the minimum number of times to paint.

The second point: two points. It's very similar to NOIP2013 's building block contest, but the subject can be painted in a row, but it's important to note that we only need a column of coloring if there's only one column in the area we're currently working on, so the difference is not big.

3. Chebnear Farm

Probably test instructions: There are n points in the coordinate system, there is a weight between any two points, if its Manhattan distance is less than equal to K, then there is a hostile relationship between the two points. We are now going to select some edges so that the maximum weight of these edges is minimized, and the point pairs that satisfy any hostile relationship end up in the same connected block.

Summary: This is a good question, I used O (n^2) to record all the distance to meet the point pair, and then O (M log m) with and check the merger and lookup points between the relationship between, apparently too violent.

The most recent point pair of plane. This is the core of the subject, whether you are violent or non-violent, using O (n log n) to find the nearest pair, the complexity will be a small section.

[Puzzle + Summary]20151015 Division

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.