Pagini recente » Monitorul de evaluare | Diferente pentru problema/multimi intre reviziile 1 si 8 | Atasamentele paginii Xerox | Obj | Diferente pentru problema/minperm intre reviziile 1 si 2
Nu exista diferente intre titluri.
Diferente intre continut:
== include(page="template/taskheader" task_id="minperm") ==
Poveste şi cerinţă...
The beautiful city of $Julcvari$ decided to host a city tour(online, of course). They have $n$ different attractions, the $i$`th one having a beauty equal to $i$. An initial order for the presentation of the attractions has been selected, but the people of $Julcvari$ started worrying that it might not be the best one.
They believe that the best order for visiting the attractions is the one for which the number of pairs of attractions ($i$, $j$), where $i$ was visited before $j$ but $i$ is more beautiful than $j$ is minimised. But organizing events is not so easy, a lot of paperwork needs to be done in order to change something like this.
So, the host managed to get $k$ swap plans: let $l_1$, $l_2$, \ldots{}, $l_k$ be an array of integers representing the swap plans. The host can perform any number of swaps on the initial order, such that the swapped positions are at a distance equal to one of the elements from array $l$. There is not much time left, so the people of $Julcvari$ ask you for help in finding the best order in which the attractions are presented.
In other words, a permutation of size $n$ and an array of size $k$ with distinct elements are given. You can only perform swaps between positions $i$ and $j$ such that $|j - i|$ is equal to an element of $l$. What is the permutation with the minimum number of inversions that can be obtained?
h2. Date de intrare
Nu exista diferente intre securitate.
Topicul de forum nu a fost schimbat.