Logo
(追記) (追記ここまで)

21763번 - Bingo 서브태스크스페셜 저지다국어

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

문제

Bingo is a game on a square grid. Each player gets an $n \times n$ grid and writes a unique number in each cell. The game host then draws a random number, and each player looks for that number on their grid and, if the number is present on their grid, fills in the corresponding cell. This repeats until someone finds $n$ filled cells on a single line, which we will call a bingo line.

There are 2ドルn + 2$ possible bingo lines: $n$ horizontal lines, $n$ vertical lines, and 2ドル$ diagonal lines.

--- ... ... |.. .|. ..| \.. ../
... --- ... |.. .|. ..| .\. ./.
... ... --- |.. .|. ..| ..\ /..

For example, the following grid has four bingo lines: two horizontal lines, one vertical line, and one diagonal line.

#..#.
#####
..###
#####
..###

Exactly when is a bingo line formed? That is completely random: you can get a line quite early if you are lucky, but on the other hand, you can fill most of the grid without getting any bingo lines. In this problem, we investigate the unfortunate case of filling $k$ cells without making any bingo lines.

Given two integers $n$ and $k,ドル determine whether it is possible to fill exactly $k$ cells in an $n \times n$ grid, without making any bingo lines. If it's possible, demonstrate how to do it.

입력

The first and only line of input contains two integers, $n$ and $k$.

출력

On the first line, output YES if it's possible to fill exactly $k$ cells of an $n \times n$ grid without making any bingo lines. Otherwise, output NO.

If the answer is YES, then output each row of the grid starting from the next line. Each row should be represented by a string of $n$ characters. The $i$-th character is # (ASCII 35) if the $i$-th cell of the row is filled, and . (ASCII 46) if it's not filled. Exactly $k$ cells must be filled, and there cannot be any bingo lines.

If there are multiple ways to fill the grid, then output any one of them.

제한

  • 1ドル \leq n \leq 100$
  • 0ドル \leq k \leq n^2$

서브태스크 1 (19점)

This subtask has an additional constraint:

  • $k \leq n-1$

서브태스크 2 (35점)

This subtask has an additional constraint:

  • $n \leq 4$

서브태스크 3 (46점)

This subtask has no additional constraints.

예제 입력 1

4 2

예제 출력 1

YES
##..
....
....
....

예제 입력 2

4 16

예제 출력 2

NO

노트

Note that the second example is only valid for subtasks 2 and 3.

출처

University > KAIST > KAIST RUN Spring Contest > 2021 KAIST RUN Spring Contest A번

Camp > Petrozavodsk Programming Camp > Winter 2022 > Day 2: Grand Prix of Daejeon B번

Contest > Open Cup > 2021/2022 Season > Stage 11: Grand Prix of Daejeon B번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /