Join the social network of Tech Nerds, increase skill rank, get work, manage projects...

• # Python Programming Task Help

• 0
• 0
• 0
• 0
• 0
• 0
• 0
• 24
Answer it

Hi please could you someone help me with this python question. Part of my uni course!!! Only have an hour till submission and totally lost. Thank you so much! Any help at this point would be appreciated.

TASK

A virus is spreading across the Island of Occavia. Computer Scientists can help. You have been asked to advise the government.

Virus testers have been instructed to identify all infected people. Virus testers could obviously be placed all over the island, but there is a shortage of virus testers.

The island can be seen as a rectangular grid of squares. Each square is a county. If you place a virus tester in a county you can be certain that all infected people will be identified.

It is expected that people will migrate across the island when they realise the need for testing. You know that infected people will move from county to county to county...

You have data from a study that involved going through the entire island to see which direction people will move from each county. This information does not tell you where the infected people are, but it does tell you how they will move through Occavia.

Task:
Write a program that determines what the minimum number of virus testers is that you should place to ensure that you will identify all infected people, no matter where they currently are.

Input:
On the first line of the input are two integers n and m, separated by a space.
n and m are greater than 0 and less than 1001. These integers indicate the size of the island.
On the next n lines you will find m characters ('N','S','E','W') that indicate in what direction an infected person in a county will go once the movement of people starts.
No infected person will ever walk off the island.

Output:
Write one number that indicates what the minimum number of virus testers is that you need to ensure that you will be able to identify every infected person.

Example Input:

```3 4
SWWW
SEWN
EEEN
```

Example output:

```2
```

How this is graded:
For small islands, where n and m range from 1 to 5, there are 4 marks available. To get the full 10 marks your program will need to be able solve the problem, in a reasonably short amount of processing time, for islands where n and m range from 100 to 1000.

## 0 Answer(s)

Sign In
OR
OR
Register

Sign up using

OR
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password:

• Hire
• Post Projects

### Post Projects

• All at 0 Cost ....
• Post Tech Job
• Select Best Bidder
• Track the Project
• Approve Work and Pay safely
• Browse Nerds
• Work
• Find Projects Find Projects
• UI Design and UX
• Software Engineering
View more...
View less...
• Marketing
• General
View more...
View less...
• Business
• Manage
• Company Company

### Manage Company

• All at 0 Cost ....
• Manage Company and Employee Profiles
• Use Online Project Management Tools for Free
• Company wide Employee Productivity Reports
• Knowledge Sharing and Collaboration Tools
• Get Sales Lead and Bid for Tech Projects
• Send Invoices and Receive Payment Safely
• Learn
• Nerd Digest Nerd Digest
• UI Design and UX
• Software Engineering
View more...
View less...
• Marketing
• General
View more...
View less...
• Business
• Tech Q & A Tech Q & A
• UI Design and UX
• Software Engineering
View more...
View less...
• Marketing
• General
View more...
View less...
• Business
• Record & Share

### Desktop Recording Tool

• All at 0 Cost ....
• Online tool for Recording Desktop Activity and Audio
• Store and Share from the Cloud
• Creating Software Product Demos
• Creating video tutorials
• Recording and Reporting Software and Project issues as videos
• Ask Tech Query
• Post Blogs