RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
문제 COCI00712

Kist

설명

Ivo is in a square matrix of \(n\) rows and \(n\) columns where \(n\) is an odd number and
holds a magic brush of thickness \(k\). All cells of the matrix are marked with the
symbol ".", and Ivo is in the central cell of the matrix.
Ivo has received a string of instructions, a word consisting of uppercase letters
of the alphabet where each letter represents one instruction. He executes the
instructions in order and does the following depending on the current instruction:
• L - Ivo moves one cell to the left
• R - Ivo moves one cell to the right
• U - Ivo moves one cell up
• D - Ivo moves one cell down
• If the current character is any other letter of the alphabet, Ivo does not
change his position. Instead, he paints all the cells of the matrix that a\(re * le\)ss than \(k\) cells away
from his current position with the current color, regardless of whether they have already been
painted in another color.
If Ivo moves outside the matrix, he will skip that step and continue executing the subsequent instructions.
Your task is to print the appearance of the matrix after Ivo has executed all the instructions.
*The distance between two cells of a matrix is the minimum number of moves needed to get from one cell
to the other, with movement allowed in four directions (up, down, left, right).

제약
입력 형식

The first line contains the natural numbers n, k (\(1 \le n\), \(k \le 50\)), from the text of the task.
The second line contains a word consisting of uppercase letters of the English alphabet. The length of the
word will be less than or equal to 50.

출력 형식

In \(n\) lines, print \(n\) characters per line, the appearance of the matrix after Ivo executes all the instructions.

서브태스크
서브태스크점수설명

1

2점

\(n = 1\)

2

10점

\(k = 1\)

3

15점

\(k = 2\)

4

23점

No additional constraints.

예제 1
입력
1 1
ALURDF
출력
F
예제 2
입력
3 2
LUUADDRCRB
출력
AA.
ACB
CBB
설명

Clarification of the first example:
Ivo will never move from the only cell of the matrix and will only paint that cell. After executing all the
instructions, that cell is colored in color F.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2025/2026 Contest 3

평가 및 의견

Kist

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Kist

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8