Processing math: 100%
Parking - MarisaOJ: Marisa Online Judge

Parking

Time limit: 1000 ms
Memory limit: 256 MB
There are n slots on a circular parking enumerated from 1 to n. There are n cars that want to park in the natural order. ith car wants to park at pith slot. If the car drives to a parking slot and her slot is occupied, it drives in a circular manner and parks on the first vacant slot. ### Input - The first line contains integer n, the size of the parking and the number of cars. - The second line contains n integers, the slot that wants to be occupied by car i. ### Output Output n numbers. ith number should be the parking slot which was occupied by ith car. ### Constraints - 1≤n≤105. - 1≤pi≤n. ### Example Input: 3222 Output: 231