F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

IT Companies

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 750    Accepted Submission(s): 273


Problem Description
There are N IT companies which are labeled from 1 to N. Each of them has a branch (a branch is not a company, and companies and branches are all called "unit").The branches are labeled from -1 to ¨CN. The branch of company i is labeled as -i. The number of workers of each company and its branch has to fit the rules below:
1. The number of workers of a company must be larger than that of the branch of it.
2. There are more workers in company i than company j if and only if there are more workers in the branch of company i than the branch of company j.
Among the companies whose label is larger than i£¨range from i+1 to n£©,and the branches whose label is larger than -i (range from -1 to ¨C(i-1) ), there are c[i] units which have more workers than company i.
You need to sort the 2¡ÁN units in the ascending order by the number of workers.
 

Input
The input contains multiple test cases. Each test case begins with a single line containing one integer N indicating the number of companies (0 < N ¡Ü 100000). Next line contains N integers which are c[1],c[2]¡­c[N] (c[i] ¡Ü N).
The input ends with N = 0.
 

Output
For each test case, output the sorted label sequence of all units in a line. If there are no solutions, output "Impossible" instead.
This problem is special judged.
 

Sample Input
2 1 1 10 4 8 3 4 2 0 5 7 1 6 0
 

Sample Output
Impossible -8 -2 -10 -7 8 2 10 -4 7 -1 4 -3 -5 -9 1 3 5 9 -6 6
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-19 18:04:24, Gzip enabled