Logo
(追記) (追記ここまで)

11421번 - Dr Who’s Banquet 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB55332062.500%

문제

Dr. Who is organising a banquet, and will be inviting several guests. A guest is happy, if he can chat with a fixed number of other guests. We assume that guests cannot talk to themselves. Help Dr. Who make all his guests happy, if possible, by organising chats between guests.

입력

The program input is from a text file. The file contains several data sets, and each data set is encoded on a line from the file. A data set consists of n≤10000 positive integers a1, a2, … an, separated by single whitespaces. The last integer an is immediately followed by the newline character. Each number ai, with 1≤i≤n is the number of chat partners guest i would like to have. We assume that ai≤1000 for all 1≤i≤n. The last data set is followed by the end of file.

출력

If all guests can be made happy, the program output consists of a n×n matrix m, where m[i][j]=m[j][i]=1 if guests i and j chat, and m[i][j]=m[j][i]=0, otherwise. The matrix will be represented at standard output, as follows: each value m[i][j] from a row will be followed by one whitespace (including the last value from the row). Each row will be separated by the newline character. If it is not possible for all guests to be happy, then the program output is the message “fail”. The matrix and the message are allways followed by an empty line.

제한

예제 입력 1

3 3 1 1
4 4 3 3 2 2 2
3 3 1 1
2 2 2 2

예제 출력 1

fail
0 1 1 0 1 0 1
1 0 0 1 1 0 1
1 0 0 1 0 1 0
0 1 1 0 0 1 0
1 1 0 0 0 0 0
0 0 1 1 0 0 0
1 1 0 0 0 0 0
fail
0 1 1 0
1 0 0 1
1 0 0 1
0 1 1 0

힌트

출처

ICPC > Regionals > Europe > Southeastern European Regional Contest > SEERC 2012 A번

  • 스페셜 저지를 만든 사람: ntopia
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /