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

32841번 - Welcome Sign 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB127978575.893%

문제

Amanda is opening a new bakery in town. She will put up a fancy LED sign to show a grand opening message on the storefront window. The sign has $r$ rows and $c$ columns of display units. Each unit can display one letter or be blank.

Amanda has written a message consisting of exactly $r$ words. She will arrange them onto the LED sign such that each row will display one word from the message in order. Each word must be as centered as possible, which means that if the number of blanks on the left side and right side of the word are $l$ and $r,ドル then $|l - r|$ must be as close to zero as possible. On those rows where $l$ cannot equal $r,ドル Amanda would like to balance the number of blanks on the two sides. More specifically, for the first and every other such row (1ドル$st, 3ドル$rd, 5ドル$th, and so forth), she would like $l$ to be less than $r$. For the other rows (2ドル$nd, 4ドル$th, 6ドル$th, and so forth), she would like $l$ to be greater than $r$.

What would the sign look like after Amanda sets it up according to the above?

입력

The first line of input contains two integers $r$ and $c$ (1ドル ≤ r, c ≤ 50$), the number of rows and the number of columns of display units.

The next $r$ lines each contain a word with at least one and at most $c$ lowercase letters (a-z), giving the words to display per row in order.

출력

Output $r$ lines. Each line must contain exactly $c$ characters representing the displayed characters on one row of the LED sign. Output a dot (.) for each blank display unit.

제한

예제 입력 1

8 7
welcome
we
are
open
free
coffee
for
icpc

예제 출력 1

welcome
..we...
..are..
..open.
.free..
.coffee
..for..
.icpc..

힌트

출처

ICPC > Regionals > North America > Southeast USA Regional > 2024 Southeast USA Regional Programming Contest > Division 1 A번

ICPC > Regionals > North America > Southeast USA Regional > 2024 Southeast USA Regional Programming Contest > Division 2 A번

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

출처

대학교 대회

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

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