CF232A.Cycles

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

John Doe started thinking about graphs. After some thought he decided that he wants to paint an undirected graph, containing exactly kk cycles of length 33 .

A cycle of length 33 is an unordered group of three distinct graph vertices aa , bb and cc , such that each pair of them is connected by a graph edge.

John has been painting for long, but he has not been a success. Help him find such graph. Note that the number of vertices there shouldn't exceed 100100 , or else John will have problems painting it.

输入格式

A single line contains an integer kk ( 1<=k<=1051<=k<=10^{5} ) — the number of cycles of length 33 in the required graph.

输出格式

In the first line print integer nn ( 3<=n<=1003<=n<=100 ) — the number of vertices in the found graph. In each of next nn lines print nn characters "0" and "1": the ii -th character of the jj -th line should equal "0", if vertices ii and jj do not have an edge between them, otherwise it should equal "1". Note that as the required graph is undirected, the ii -th character of the jj -th line must equal the jj -th character of the ii -th line. The graph shouldn't contain self-loops, so the ii -th character of the ii -th line must equal "0" for all ii .

输入输出样例

  • 输入#1

    1
    

    输出#1

    3
    011
    101
    110
    
  • 输入#2

    10
    

    输出#2

    5
    01111
    10111
    11011
    11101
    11110
    
首页