Urban Planning

시간 제한2초메모리 제한2048 MB

요약
경계가 모두 공원인 직사각형의 개수가 정확히 k가 되도록 2025×2025 이하 격자를 만든다. k는 4*10^12까지 주어진다.
난이도

어려움10점 중 8점

유형
조합론, 수학, 구현, 그리디
정답자
아직 제출이 없습니다

문제

You are responsible for planning a new city! The city will be represented by a rectangular grid, where each cell is either a park or a built-up area.

The residents will naturally want to go for walks in the city parks. In particular, a rectangular walk is a rectangle consisting of the grid cells, which is at least 2 cells long both horizontally and vertically, such that all cells on the boundary of the rectangle are parks. Note that the cells inside the rectangle can be arbitrary.

An example rectangular walk (cells with dark background).

Your favourite number is kk. To leave a long-lasting signature, you want to design the city in such a way that it has exactly kk rectangular walks.

입력

The input contains a single integer kk (0≤k≤4⋅10120 ≤ k ≤ 4 \cdot 10^{12}).

출력

On the first line, print two integers hh and ww (1≤h,w≤20251 ≤ h, w ≤ 2025), the height and width of the grid. On the next hh lines, print a string with ww characters each, with each character being #, denoting a park, or ., denoting a built-up area.

It is guaranteed that for any value of kk within the given limits, there exists a solution with height and width within the given limits. Any city within the given limits and with exactly kk rectangular walks will be accepted.

예제1

  1. 예제 1

    입력
    5
    
    예상 출력
    3 4
    ####
    #.##
    ####