comprises of an upstanding board with n lines and m sections of cells, some vacant and some loaded up with squares of sand, and m non-negative integers a1,a2,… ,am (0≤ai≤n). In this adaptation of the issue, simulated

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Correct answer will be upvoted else downvoted.

 

 

puzzle comprises of an upstanding board with n lines and m sections of cells, some vacant and some loaded up with squares of sand, and m non-negative integers a1,a2,… ,am (0≤ai≤n). In this adaptation of the issue, simulated intelligence will be equivalent to the number of squares of sand in segment I. 

 

At the point when a cell loaded up with a square of sand is upset, the square of sand will tumble from its cell to the sand counter at the lower part of the section (every segment has a sand counter). While a square of sand is falling, different squares of sand that are adjoining anytime to the falling square of sand will likewise be upset and begin to fall. In particular, a square of sand upset at a cell (i,j) will go through all cells underneath and including the cell (i,j) inside the section, upsetting all nearby cells en route. Here, the cells adjoining a cell (i,j) are characterized as (i−1,j), (i,j−1), (i+1,j), and (i,j+1) (in case they are inside the network). Note that the recently falling squares can upset different squares. 

 

In one activity you can upset any piece of sand. The riddle is tackled when there are basically artificial intelligence squares of sand included in the I-th sand counter for every section from 1 to m. 

 

You are presently entrusted with tracking down the base measure of tasks to settle the riddle. Note that Little Dormi won't ever give you a riddle that is difficult to settle. 

 

Input 

 

The principal line comprises of two space-isolated positive integers n and m (1≤n⋅m≤400000). 

 

Every one of the following n lines contains m characters, portraying each line of the board. On the off chance that a character on a line is '.', the comparing cell is unfilled. In case it is '#', the cell contains a square of sand. 

 

The last line contains m non-negative integers a1,a2,… ,am (0≤ai≤n) — the base measure of squares of sand that requirements to fall beneath the board in every segment. In this rendition of the issue, computer based intelligence will be equivalent to the number of squares of sand in segment I. 

Output :Print one non-negative integer, the base measure of tasks expected to settle the riddle.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY