Problem setter's tough life P82250


Statement
 

pdf   zip

Professor Oak has written another problem for a competition (the OIcat). The statement reads:

“Consider an n×mn \times m board with obstacles. We must go from the upper-left cell to the lower-right cell, making horizontal and vertical moves, never leaving the board, and never going through an obstacle…”

Later:

”In the given test cases, both nn and mm will be between 1 and 100, and the number of paths of minimum length will belong to [1,106][1, 10^6]…”

What is required in that problem is irrelevant here. The issue is that now Prof. Oak must create those boards. Can you help him?

Input

Input consists of several cases, each with a natural pp between 1 and 10610^6.

Output

For each pp, print first a line with nn and mm (both between 1 and 100), followed by nn lines with mm characters each: a ‘.’ indicates a free cell, and an ‘X’ indicates an obstacle. The board must have exactly pp paths of minumum length. Since, in general, there will be more than one solution, print any of them. Print a line with 10 dashes at the end of each case. Follow strictly the format of the sample output.

Public test cases
  • Input

    1
    1
    3
    12
    7
    11628
    

    Output

    1 1
    .
    ----------
    7 9
    .X.......
    ...XXXXX.
    .X.XXX...
    .X.XXX.XX
    .X...X...
    .X.X...X.
    ...X.XXX.
    ----------
    5 10
    .XX.X...X.
    ......X...
    .XXXX...X.
    .X...XXXX.
    ...X......
    ----------
    2 11
    ...X......X
    X.....X....
    ----------
    6 6
    ......
    .XXX..
    ..XX..
    ..XXX.
    ..XXX.
    ......
    ----------
    6 15
    ...............
    ...............
    ...............
    ...............
    ...............
    ...............
    ----------
    
  • Information
    Author
    Félix Miravé and Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++