402389: GYM100741 K $n$-Way Tie
Description
In the country of Tieland, there is an annual tie tying tournament that hosts n participants numbered with integers from 1 to n. Each two participants meet exactly once and have a match in tie tying. There is a winner and a loser in each of the matches. A participant obtains a point for each match victory, and the loser gets zero points for that match. The score of the participant is the total number of points he earned.
However, the jury is worried of the scenario in which all participants have exactly the same score; in other words, there is an n-way tie. In that case any participant would be both the winner and the loser of the competition, which is absurd! Alas, the jury is tied up with the organisation of the tournament; help them and find out whether such a situation might occur!
InputThe single line of the input contains an integer n (1 ≤ n ≤ 1000), the number of participants.
OutputIf such a scenario is possible, output "Yes" in the first line. Then output n - 1 lines, the i-th containing n - i space-separated integers. The j-th number of the i-th line aij should denote the outcome of the match between participants with numbers i and i + j:
- aij = 1, if the i-th participant won the match;
- aij = 0, if the (i + j)-th participant won the match.
If such a scenario is not possible, output "No" in a single line.
ExamplesK. n-Way Tie2Output
NoInput
3Output
Yes
1 0
1