|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||0||0||0||0.000%|
The Matchball tennis club is organizing a "game interest week" to attract new players to the club. As one of the attractions, they have asked some star players to play a few demo games. Each star has indicated the number of games he or she is willing to play. The organizers want the stars to have some fun as well, thus they want to schedule the games so that no two players meet more than once with each other.
Your task is to write a program to help them match the players into pairs so that each player plays his or her desired number of games and does not play twice or more against any other player. Of course, no player may play against himself or herself.
On the first line of the input is the number of players N (2 ≤ N ≤ 1000) and on the following N lines is the desired number of games to play Gi (1 ≤ Gi < N) for each player. Assume that the players are numbered from 1 to N in the order of their wishes in the input file.
On the first line of the output write NO SCHEDULE if it is not possible to create a schedule so that the wishes of all players are satisfied, or SCHEDULE if it is possible.
If a schedule exists, write it out on the following N lines. On each line write the indices of opponents for the player whose desired number of games was indicated on the corresponding input line. On each line the indices must be in increasing order and separated by spaces. If multiple solutions exist, output any one of them.
3 1 2 1
SCHEDULE 2 1 3 2
3 2 2 1
In this task, a program receives points for tests with no schedule only if it solves correctly at least half of the tests with a schedule.