Thursday, December 12, 2013

Said to be important because monte lake of the points other than the leg members may not be the sol


As I promised earlier, here's the discussion of CP Compfest student level. The entire source code for the discussion below can be downloaded from here. A. Prince Berti Author matter: Fikri Alham Aji Simply search for the two kingdoms to the number of women who love the prince as much as possible. After that, the answers can be obtained from the total minus the woman two women in the kingdom. B. It's a matter of Prima Author: Gede Wahyu Adi Pramana Using the algorithm is O (N 2) clearly will get TLE. Note that the sequence is not considered prime if there is a total of at least two numbers in the sequence that they both have the same prime factors. Therefore, in order to prime the row total, the whole number shall bring about the factors different prime. Solutions that can be used are: Provide a table that holds "the monte lake existence of" a prime factor. monte lake For each number in the sequence, the prime factorization of numbers, and check "where" the prime factors monte lake in the table. If there are prime factors that have previously been "No" in the table, and was about to be marked "presence" it, meaning that the row was not primed total. So the solution has a rough complexity \ (O (N \ sqrt {M}) \), where M is the average number in a row. Make sure the factorization of numbers running quickly so they can get air conditioning. C. Hybrid Breeding Author matter: William Widodo This problem monte lake can be modeled becomes: Given a number of points monte lake on the field and a number monte lake of questions which reads: "A minimum dot product of the point P with the existing one point in the field is ...." In addition to that there is the problem, another dot product formula is: \ (\ vec {a} \ cdot \ vec {b} = | \ vec {a} | | \ vec {b} | \ cos {\ theta} \) When \ (\ vec {a} \) is a vector of point P (which is in question), then the formula monte lake becomes: \ (\ vec {P} \ cdot \ vec {b} = | \ vec {P} | | \ vec {b} | \ cos {\ theta} \) Since \ (| \ vec {P} | \) is constant, monte lake live searchable \ (| \ vec {b} | \ cos {\ theta} \) is the minimum. Consider the following picture and let P be the red dots:
Observation 1: Since \ (| \ vec {b} | \ cos {\ theta} monte lake \) is equal to the projected length of the vector \ (\ vec {b} \) to the vector monte lake \ (\ vec {P} \), so that the results The minimum point b should be the first point encountered a line g, with g is perpendicular to the vector \ (\ vec {P} \) and move toward positive monte lake x and y axes. Note the series of images for the following 3 possibilities P:
Observation is an important observation, because once knew it, we can throw all the points that are not important. The points are not important are the points which are not members of "left foot" convex hull of all the points. The meaning of "left foot" of the convex hull is characterized in the following figure:
Said to be important because monte lake of the points other than the leg members may not be the solution for b. Observation 2: To answer the question, note that the answer is very dependent monte lake on the gradient of the point (0, 0) to P. Point P with the largest gradient will be optimal when paired with the right point "foot" is. Conversely, the smaller the slope it will be optimal when paired with a dot in the left area. For example: K = [T 1, T 2, ..., T m] is the convex monte lake hull left foot, the x coordinate sequences of the smallest. L = [P 1, P 2, ..., PQ] are the questions that have been sequenced by the rules described earlier. First we find the optimal partner for P 1. Ascertained, T m is the optimal partner. To calculate P 2, T m may partner again, or T m-1, or even T x, where (x <m). Therefore, we can use: i <- m during the dot (P 2, T i-1) <dot (P 2, T i) i <- i-1 Note: dot (A, B) states the dot product of position vector of point A and B then after a while it's on, i is guaranteed to stop the optimal partner. This strategy can also continue monte lake to look for P 3, P 4, and so on. For the record, here i value will continue to decrease (due to observation 2). Since m can be equal to N, the complexity to answer the question in this way is O (Q + N). There are other ways to answer the question, namely the binary search. To find a pair P i, do a binary search on K. Guaranteed, dot graphic form (P i, T j) is a U-shaped curve So stay sought its lowest point. Complexity to answer the question is O (Q log N). Overall, required O (N log N) to perform the convex hull, and O (Q + N) or O (Q log N) to answer questions. In other words, the complexity eventually monte lake O (N log N + Q) or O ((N + Q) log N). D. Mixed Multiple Choice monte lake question Author: William Widodo This issue requires us to determine the optimum selection among the many options. Unfortunately, the DP can not be applied because the state owned too big. If further attention, this problem can be direduk

No comments:

Post a Comment