QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 256 MB مجموع النقاط: 100

#22374. 레이저 전화

الإحصائيات

소들은 목장에서 편하게 대화할 수 있는 새로운 레이저 시스템을 갖게 되었습니다. 목장은 $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.