PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000125. Lát lại quảng trường (New Theatre Square)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Lát lại quảng trường (New Theatre Square)
New Theatre Square
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
An board contains white cells . that must be covered and blocked cells * that cannot be covered. A single horizontal tile costs and a horizontal tile costs . Cover every white cell without overlap for minimum cost.
Input
The first line contains . Then follow strings of length , each containing only . and *.
Output
Print the minimum tiling cost.
Subtasks
- Subtask 1 (20 points): ; ; ; each row has exactly characters from
.hoặc*. - Subtask 2 (30 points): ; ; ; each row has exactly characters from
.hoặc*. - Subtask 3 (50 points): ; ; ; each row has exactly characters from
.hoặc*.
Examples
Input
2 3 3 4
..*
...
Output
11
Explanation
Cover the two adjacent white cells in row one with a double tile (). Row two needs one double tile () and one single tile (). Total cost is .