QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22374. レーザー電話

Statistics

牛たちは牧場で気軽に会話できる新しいレーザーシステムを手に入れました。牧場は $W \times H$ 個の点の格子($1 \le W \le 100; 1 \le H \le 100$)で表されます。

通信を維持するには、ある種の見通しによる接続が必要です。牧場の岩や木は通信を妨げますが、牛たちはレーザーを $90$ 度曲げる斜めの鏡(下図の / と \)を購入しました。次の地図が状況を示します。

この地図では $H=8$、$W=7$ です。通信する二頭の牛は $C$、岩などの障害物は * で示します。

7 . . . . . . .         7 . . . . . . .
6 . . . . . . C         6 . . . . . /-C
5 . . . . . . *         5 . . . . . | *
4 * * * * * . *         4 * * * * * | *
3 . . . . * . .         3 . . . . * | .
2 . . . . * . .         2 . . . . * | .
1 . C . . * . .         1 . C . . * | .
0 . . . . . . .         0 . \-------/ .
  0 1 2 3 4 5 6           0 1 2 3 4 5 6

二頭の牛のレーザー通信を維持するために設置する鏡の最小数 $M$ を求めてください。与えられるテストデータでは必ず可能です。

入力

  • 1 行目:空白区切りの二つの整数 $W$ と $H$。
  • $2,\ldots,H+1$ 行目:牧場全体。

出力

  • 1 行目:一つの整数 $M$。

入出力例

入力 1

7 8
.......
......C
......*
*****.*
....*..
....*..
.C..*..
.......

出力 1

3

問題のクレジット:Rob Kolstad, 2008

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.