Pagini recente » Istoria paginii utilizator/vladapfelbaum | Istoria paginii utilizator/grigore_stefan | Diferente pentru utilizator/vladtzy intre reviziile 7 si 8 | Monitorul de evaluare | Diferente pentru tygyn/solutie intre reviziile 1 si 4
Diferente pentru
tygyn/solutie intre reviziile
#1 si
#4
Nu exista diferente intre titluri.
Diferente intre continut:
The solution is based on a special and innovative tree that contains all natural numbers. We will call this special tree the Divisor Tree. The root of the tree is vertex number $1$. Each number greater than 1 can be written as a product of prime numbers. The father of any vertex is the number equal to the number divided by the largest prime number dividing it. For example, $3 * 5 * 5 * 7$ has $3 * 5 * 5$ as father, while $2 * 2 * 2$ has $2 * 2$ as father.
\centerline{\includegraphics[scale=.5]{avem.png}}
!>tygyn/solutie?avem.png!
In order to understand its structure, you can have a look on the image above. Here you can find a descriptive part of the Divisor Tree. Note that all prime numbers share an edge with root number $1$, and the height of each vertex is equal to the number of times you should divide it by a prime number in order to make the number equal to $1$ (the sum of exponents of the prime numbers in its factorisation).
In order to understand its structure, you can have a look on the image to the right. Here you can find a descriptive part of the Divisor Tree. Note that all prime numbers share an edge with root number $1$, and the height of each vertex is equal to the number of times you should divide it by a prime number in order to make the number equal to $1$ (the sum of exponents of the prime numbers in its factorisation).
If we have a look at the Divisor Tree, at its properties and structure, in relationship with the task statement, we will see that one can make a herd of all the cows whose numbers are in a subtree of an existing cow. Minimizing the number of herds means creating a heard for each cow, except for the ones who have an ancestor in the tree. If the cow has an ancestor in the tree, it means it can go in the herd whose representant (the minimum number in the herd) is the existing ancestor. This way, both the correctness of the herds and their minimality are respected.
The solution also requires some knowledge of the prime numbers up to $M$. We can use the sieve of Eratosthenes to find them, or the linear sieve for finding all primes up to some number. The final complexity is $O(N + M * \log(\log M))$ or $O(N + M)$, depending on how the sieve is implemented.
h3. Request
h3. -Request- Notice
Contacteaza-l pe autor daca te oferi sa traduci enuntul in limba romana.
-Contacteaza-l pe autor daca te oferi sa traduci enuntul in limba romana.- Multumim lui ==user(user="Matteoalexandru" type="tiny")== pentru 'traducere':tygyn/solutie_romana
Nu exista diferente intre securitate.
Topicul de forum nu a fost schimbat.