QOJ.ac

QOJ

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

#22374. Telefony laserowe

Statistics

Krowy mają nowy system laserowy do swobodnych rozmów na pastwisku modelowanym jako siatka $W \times H$ punktów ($1 \le W \le 100; 1 \le H \le 100$).

System wymaga pewnego połączenia w linii widzenia, by utrzymać komunikację. Skały i drzewa ją zakłócają, ale krowy kupiły ukośne lustra (/ i \ poniżej), które obracają promień o $90$ stopni. Poniższa mapa ilustruje problem.

Na tej mapie $H=8$ i $W=7$. Dwie rozmawiające krowy oznaczono $C$, a skały i inne przeszkody — *:

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

Wyznacz minimalną liczbę luster $M$, które trzeba zainstalować, by utrzymać komunikację laserową między dwiema krowami. W danych testowych jest to zawsze możliwe.

Wejście

  • Wiersz 1: dwie liczby całkowite oddzielone spacją: $W$ i $H$.
  • Wiersze $2,\ldots,H+1$: całe pastwisko.

Wyjście

  • Wiersz 1: jedna liczba całkowita $M$.

Przykład

Wejście 1

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

Wyjście 1

3

Autor zadania: 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.