시간 제한메모리 제한제출정답맞힌 사람정답 비율
20 초 (추가 시간 없음) 1024 MB0000.000%

문제

In honor of Google I/O 2017, we would like to make an I/O-themed word search grid. This will be a rectangular grid in which every cell contains one of the three characters I/, or O. The people solving our word search will look for all instances of the string I/O that appear contiguously forwards or backwards in a row, column, or diagonal. For example, the following grid contains eight instances of I/O, representing all eight possible directions in which the string can appear:

OOOOO
O///O
O/I/O
O///O
OOOOO

To control the difficulty level of our word search, we would like the string to appear exactly N times in the grid. Moreover, we do not want the grid to be too large; it cannot have more than D rows or more than D columns.

Can you help us design a grid that meets these specifications?

입력

The first line of the input gives the number of test cases, TT test cases follow. Each test case consists of one line with two integers D and N, as described above.

출력

For each test case, first output one line containing Case #x:. Then output R lines of exactly C characters each, representing the rectangular grid. Each of those characters must be either I/, or O. You may choose any values of R and C as long as both are at least 1 and neither exceeds D. Your grid must contain exactly N instances of the string I/O, per the rules described in the statement.

If there are multiple valid answers, you may output any of them.

제한

  • 0 ≤ N ≤ 287.
  • It is guaranteed that at least one valid grid exists for each test case.

Test Set 1 (10점)

  • 1 ≤ T ≤ 25.
  • D = 50.

Test Set 2 (15점)

  • 1 ≤ T ≤ 100.
  • D = 15.

예제 입력 1

4
50 1
50 0
50 3
50 8

예제 출력 1

Case #1:
O
/
I
Case #2:
IO
Case #3:
IIIOOO
/I/O/O
IIIOOO
Case #4:
OOOOO
O///O
O/I/O
O///O
OOOOO

힌트

The sample output displays one set of answers to the sample cases. Other answers may be possible. Note that these cases would only appear in the Small dataset.

채점 및 기타 정보

  • 예제는 채점하지 않는다.