402389: GYM100741 K $n$-Way Tie

Memory Limit:256 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

n-Way Tietime limit per test0.3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

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!

Input

The single line of the input contains an integer n (1 ≤ n ≤ 1000), the number of participants.

Output

If 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 multiple solutions exists, output any of them.

If such a scenario is not possible, output "No" in a single line.

ExamplesK. n-Way Tie
2
Output
No
Input
3
Output
Yes
1 0
1

加入题单

算法标签: