0124. Reversive Inversions
Имя входного файла: | invers.in |
Имя выходного файла: | invers.out |
Ограничение по времени: | 500 ms |
Ограничение по памяти: | 64 megabytes |
Inversion table for a permutation P of numbers {1,2,…,N} is the table A=(Ai)1 ≤ i ≤ N which maps each i=Pj into the number of indices j' such that j' ≤ j but Pj'>Pj=i.
Given an inversion table for a permutation P, calculate the inversion table for the inverse permutation P-1.
Input file
File consists only of N integer numbers, delimited by spaces and newline characters, that form the inversion table of a permutation. You may assume that 1 ≤ N ≤ 5000.
Output file
Output N integer numbers separated by single spaces – inversion table for the inverse permutation. Leave no trailing spaces at the end of the single line of output.
If there are several possible answers, output any of them. If there are no answers, output the first N primes instead.
Examples:
invers.in | invers.out |
---|---|
5 0 1 3 2 1 0 | 1 5 1 3 2 0 0 |
Источник: Petrozavodsk Summer 2003. Blitz Kontest, Monday, August 25
Автор: Andrew Lopatin, Nick Durov
Обсудить Отправить решение
Версия для печати