ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Kovrov IT > задача:


50384 - Permutations revisited

Гость
• Вопросы к жюри (1)

Задачи сборника

• 50382 - Parkside's Other Triangle
• 50377 - kth Permutation
• 50304 - Number Pattern
• 50322 - Snake Pattern
• 50321 - Missing Number
• 50317 - Student Line Up
• 50311 - Student Line Up
• 50384 - Permutations revisited
• 50841 - My grand-grand-grandfather
• 50380 - Sum of the Numbers in the ...
• 50395 - Page "Like" Averages
• 50332 - Variance of a series
• 50398 - Sum of kth Anti-diagonal
• 50323 - Filtering Contact List
• 50400 - nth Row rth Element of a Table
• 50364 - Student averages

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Prepared by Ibrahim Mesecan.

Permutations revisited

 

In previous contest you were asked to find the k-th permutation of a series in lexicographical order, for a given k. Now, we are asking for the inverse: you are given a permuted series, and you need to output its order. The inputs admit that k can have at most 15 digits.

 

Sample Input 1                                  Sample Output 1

4                                                          8

2 1 4 3

 

Sample Input 2                                  Sample Output 2

5                                                          110

5 3 1 4 2

 

Explanation for sample output 1:

1 2 3 4  // First permutation

1 2 4 3

1 3 2 4

1 3 4 2

1 4 2 3

1 4 3 2

2 1 3 4

2 1 4 3   // 8th permutation

 

Для отправки решений необходимо выполнить вход.

www.contester.ru