![]() |
||||||||||
|
||||||||||
IT CompaniesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 751 Accepted Submission(s): 274 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
Sample Output
Source | ||||||||||
|