問題一覧 > 通常問題

No.455 Winter Triangle

レベル : / AI推定難易度 : 575 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 210
作問者 : くれちー / テスター : はむこ
お気に入りにしたユーザー ProblemId : 1438 / 自分の提出
問題文最終更新日: 2026-06-25 06:34:28
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
Advent Calendar Contest 2016 (順位表) の他の問題:

Note

This problem was created as the Day 6 problem of Advent Calendar Contest Advent Calendar 2016.

Problem Statement

One day in December, you happen to look up at the night sky and see it filled with stars.
Y-kun searched among them for the three stars that form the "Winter Triangle",
but he just cannot find the last one.

Now, you are given the state of a night sky of height $H$ and width $W$,
in which only the two stars Y-kun found exist.
Add one star to this night sky at a position such that connecting the three stars forms a triangle.
A triangle of any shape will be accepted.

Addendum: It is guaranteed that at least one solution exists.

Supplement

Connecting the three stars forms a triangle refers to states such as the following.
Note: '*' represents a star, and '-' represents nothing.

---------*--
-*----------
------------
---------*--
*-----------
*-----------
------------
-*----------

If the three stars lie on a single straight line, they do not form a triangle.

----*-------
----*-------
------------
----*-------
-*----------
----*-------
------------
----------*-

Input

$H$ $W$
$S_1$
$S_2$
$\vdots$
$S_H$

The first line contains the vertical size $\,H$ and the horizontal size $\,W\,$ of the night sky.
The following $H$ lines give the state of the night sky Y-kun saw, as strings $S_i$ of length $W$.
$S_i$ consists only of '*', representing a star, and '-', representing nothing.
It is guaranteed that there are exactly two stars.

  • $H,W$ are integers
  • $2 \le H,W \le 100$

Output

Output the state of the night sky after adding one star at a position such that the three stars form a triangle,
in the same way as the input, as $H$ lines of strings of length $W$.
Print a newline at the end.

Sample

Sample 1
Input
4 10
----------
-------*--
--*-------
----------
Output
----------
-------*--
--*-------
-------*--

This output is one example.

Sample 2
Input
6 2
--
*-
--
--
--
*-
Output
--
*-
-*
--
--
*-

It is long and thin, but it is a triangle.

Sample 3
Input
12 50
--------------------------------------------------
---------*----------------------------------------
--------------------------------------------------
-----------------------------------------*--------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
Output
--------------------------------------------------
---------*----------------------------------------
--------------------------------------------------
-----------------------------------------*--------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
--------------------*-----------------------------
--------------------------------------------------

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。