Advertisement
Guest User

dada

a guest
Feb 27th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. To definitely survive and win the Battle, you have to take cover, and the **safe zone** is shrinking dangerously.
  2.  
  3. The map is represented in 1 dimension, and is composed of safe areas (`.`) and dangerous areas (`#`).
  4.  
  5. Every minute, a secure area of the map becomes dangerous. Only a safe area touching a danger zone can become dangerous.
  6.  
  7. For example, the `.#..` map may become `##..` or `.##.` one minute later, but not `.#.#`.
  8.  
  9. In order to survive and finally win the Battle, write a function that, starting with the current map, returns the number of ways to completely turn the map dangerous.
  10.  
  11.  
  12. ## Input
  13.  
  14. The map `grid` is represented in 1 dimension, and is divided into zones: `#` is a dangerous zone, `.` is a secure zone. There are less than 1000 zones per map.
  15.  
  16. The input is a made of 20 testcases (at the bottom of this file), each testcase has the size of the map as its first line and the map as its second line.
  17.  
  18. ## Output
  19.  
  20. You must print one integer per test case representing the number of ways there are to completely turn the map dangerous.
  21.  
  22. This integer must be returned **modulo 10^9 + 7**.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement