시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 6 3 2 66.667%

문제

Matchball 테니스 클럽에서 새로운 회원을 모집하기 위해 "game interest week"를 개최한다. 이목을 끌기 위해 스타플레이어들이 데모게임을 하는데, 각 플레이어는 뛸 경기수를 정하고 주최측은 재미를 위해 각 플레이어들이 서로 두번이상 매치되지 않게 대진표를 짜길 원한다. 각 플레이어들이 정한 횟수만큼 경기를 치르되 두번이상 같은 선수와 매치되지 않게 대진표를 만드는 프로그램을 구현하시오.(자기자신과는 매치될 수 없다.)

입력

첫줄에는 플레이어의 수 N이 입력된다. (2 ≤ N ≤ 1000)

다음 N줄에는 각 플레이어의 게임횟수 Gi가 입력된다.(1 ≤ Gi < N)

플레이어들은 지망한 순서대로 1~N까지 번호가 매겨져 있다고 가정한다.

출력

첫줄에는 모든 플레이어의 매치가 만족한다면 'SCHEDULE' 아니라면 'NO SCHEDULE'을 출력한다.

스케줄이 존재한다면 게임횟수 입력줄에 대응되는 상대선수의 번호를 N줄까지 한줄씩 출력한다. 각 줄에는 선수번호가 오름차순으로 공백으로 구분하여 출력되야한다. (여러가지 해결방법이 존재한다면 그 중 하나를 출력한다.)

예제 입력 1

3
1
2
1

예제 출력 1

SCHEDULE
2
1 3
2

예제 입력 2

3
2
2
1

예제 출력 2

NO SCHEDULE
W3sicHJvYmxlbV9pZCI6IjMzODYiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWQxNGNcdWIyYzhcdWMyYTQgXHVkMDc0XHViN2ZkIiwiZGVzY3JpcHRpb24iOiI8cD5NYXRjaGJhbGwgXHVkMTRjXHViMmM4XHVjMmE0IFx1ZDA3NFx1YjdmZFx1YzVkMFx1YzExYyBcdWMwYzhcdWI4NWNcdWM2YjQgXHVkNjhjXHVjNmQwXHVjNzQ0IFx1YmFhOFx1YzlkMVx1ZDU1OFx1YWUzMCBcdWM3MDRcdWQ1NzQgJnF1b3Q7Z2FtZSBpbnRlcmVzdCB3ZWV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5kIHNlcGFyYXRlZCBieSBzcGFjZXMuIElmIG11bHRpcGxlIHNvbHV0aW9ucyBleGlzdCwgb3V0cHV0IGFueSBvbmUgb2YgdGhlbS4mbmJzcDs8XC9wPlxyXG4iLCJoaW50IjoiPHA+SW4gdGhpcyB0YXNrLCBhIHByb2dyYW0gcmVjZWl2ZXMgcG9pbnRzIGZvciB0ZXN0cyB3aXRoIG5vIHNjaGVkdWxlIG9ubHkgaWYgaXQgc29sdmVzIGNvcnJlY3RseSBhdCBsZWFzdCBoYWxmIG9mIHRoZSB0ZXN0cyB3aXRoIGEgc2NoZWR1bGUuJm5ic3A7PFwvcD5cclxuIiwib3JpZ2luYWwiOiIxIiwicHJvYmxlbV9sYW5nX2NvZGUiOiJcdWM2MDFcdWM1YjQifV0=

출처

Olympiad > Baltic Olympiad in Informatics > BOI 2002 2번

  • 문제를 번역한 사람: dark2840
  • 스페셜 저지를 만든 사람: onjo0127