NOIP 2014 FAQ

Source: Internet
Author: User

NOIP 2014 FAQ
Day1T1 is actually a question about whether you can program. There is a pitfall in the T2 question. N-1 1 edges exist in the undirected graph of n points, which is obviously a tree. Because it is A tree, we do not need to run the shortest path, and there is no such fast shortest path algorithm in the world. Below are ydc ideas

Consider the point with a distance of 2 as enumeration. I , I The distance between the two points that can be reached is 2

What we need to do is for an array A1, a2, a3 ,..., Am , Requirements Aiaj, I =j Σ and max

Max is a simple task. You only need A The maximum value and secondary limit of the array.

As for Σ, we know Σ I = 1n Σ j = 1 naiaj = (Σ I = 1nai) 2 So what we need to easily launch is (Σ I = 1nai) 2? Σ I = 1na2i

You can also S = Σ I = 1nai , Please Σ I = 1nai (s? Ai)

Complexity should be O (n) Of

My thoughts are as follows:

N vertices on the enumeration tree, each of which enumerates their grandson nodes, and counts the sum of the product maximum and product of each vertex and Its grandson node.

It is reasonable to say that each vertex is counted only once, and the complexity should be O (n). Some people may say that there may be O (n ^ 2), and there may be some TLE points.

T3 type full backpack problem. I use the O (nm ^ 2) memory-based search algorithm with an estimated score of 50 ~ 70Day2T1 still test whether you will program. Note that the question requires the router to be at the intersection T2. Based on the question, we will first build an undirected graph. All sides are in the opposite direction of the source image. On this graph, run BFS or SPFA, obtain all the points connected to the endpoint, pre-filter those points that do not match the meaning of the question, and finally run BFS or SPFA on the line of the T31, O (nm) algorithm, it is m-times enumerative x, which is substituted into the equation to calculate the answer, with high precision or using multiple large prime number modulo processing. If the high precision number of digits is too long, the constant T will drop many points, there is no way I can only enable high precision with a length of 200. This problem does not exist in the modulo operation. I can get 70 points for the card and 70 points for the high precision pressure bit. 2. Ce Ye's practice:

Brute Force [1, m] All integers in the modulo sense, complexity O (nm) .

Take a prime number P [0, P? 1] To verify (Modulo P Meaning), the complexity is O (Pn) . (Pay attention to the selected P Need to ensure F (x) In the module P It will not become zero polynomial)

Then we can know the module P It cannot exceed N . (Laplace theorem)

Then [1, m] Only N ?? M/P? To verify these solutions. Complexity O (n2m/P) .

Fetch P In Nm ??? √ Nearby. Total complexity O (nnm ??? √) .


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.