Diferente pentru problema/minperm intre reviziile #2 si #3

Nu exista diferente intre titluri.

Diferente intre continut:

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.
So, the host managed to get $k$ swap plans: let $l_1$, $l_2$, ..., $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?

Nu exista diferente intre securitate.

Topicul de forum nu a fost schimbat.