Skip to content

388B

Solution

#include <cstdio>
using namespace std;

#define D(x) 

const int MAX_N = 100;

int num;
bool ans[MAX_N][MAX_N];

void connect(int a, int b)
{
    ans[a][b] = ans[b][a] = true;
}

int main()
{
    //init
    connect(1, 3);
    connect(1, 4);
    for (int i = 1; i < 30; i++)
    {
        connect(i * 2 + 1, i * 2 + 3);
        connect(i * 2 + 1, i * 2 + 4);
        connect(i * 2 + 2, i * 2 + 3);
        connect(i * 2 + 2, i * 2 + 4);
    }
    for (int i = 1; i <= 30; i++)
    {
        connect(62 + i, 63 + i);
    }
    connect(93, 2);

    //input
    scanf("%d", &num);

    //work
    int temp = 0;
    while (num > 0)
    {
        if (num & 1)
        {
            connect(temp * 2 + 1, 63 + temp);
            if (temp != 0)
            {
                connect(temp * 2 + 2, 63 + temp);
            }
        }
        temp++;
        num >>= 1;
    }

    //output
    printf("%d\n", 93);
    for (int i = 1; i <= 93; i++)
    {
        for (int j = 1; j <= 93; j++)
        {
            if (ans[i][j])
                putchar('Y');
            else
                putchar('N');
        }
        putchar('\n');
    }
    return 0;
}