Knowee
Questions
Features
Study Tools

Sabarish, A doctor forms a grid where each cell represents the condition of a patient. The cell can take any of the three values as follows:              1-The person is virus free              2-The person is infected with the virus               3-Empty cellIt takes one day for the virus to spread from one person to another. Every day any virus free person who is adjacent (4-directionally) to the infected person catches the disease.Given the initial grid help the doctor to find the minimum number of days that must elapse until everyone has been infected. If this impossible return -1.Example:-Suppose the input grid is 2 1 1                                             1 1 3                                            3 1 1After day 1 the grid will be    2 2 1                                                  2 1 3                                                  3 1 1After day 2 the grid  will be  2 2 2                                                 2 2 3                                                 3 1 1 After day 3 the grid will be 2 2 2                                               2 2 3                                               3 2 1After day 4 the grid will be 2 2 2                                               2 2 3                                               3 2 2So, the minimum number of days is 4Input format:-Numbers of row in the grid

Question

Sabarish, A doctor forms a grid where each cell represents the condition of a patient. The cell can take any of the three values as follows:              1-The person is virus free              2-The person is infected with the virus               3-Empty cellIt takes one day for the virus to spread from one person to another. Every day any virus free person who is adjacent (4-directionally) to the infected person catches the disease.Given the initial grid help the doctor to find the minimum number of days that must elapse until everyone has been infected. If this impossible return -1.Example:-Suppose the input grid is 2 1 1                                             1 1 3                                            3 1 1After day 1 the grid will be    2 2 1                                                  2 1 3                                                  3 1 1After day 2 the grid  will be  2 2 2                                                 2 2 3                                                 3 1 1 After day 3 the grid will be 2 2 2                                               2 2 3                                               3 2 1After day 4 the grid will be 2 2 2                                               2 2 3                                               3 2 2So, the minimum number of days is 4Input format:-Numbers of row in the grid

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

I'm sorry, but you didn't provide a text to respond to. Could you please provide the text?

Similar Questions

Help the doctorSabarish, A doctor forms a grid where each cell represents the condition of a patient. The cell can take any of the three values as follows:              1-The person is virus free              2-The person is infected with the virus               3-Empty cellIt takes one day for the virus to spread from one person to another. Every day any virus free person who is adjacent (4-directionally) to the infected person catches the disease.Given the initial grid help the doctor to find the minimum number of days that must elapse until everyone has been infected. If this impossible return -1.Example:-Suppose the input grid is 2 1 1                                             1 1 3                                            3 1 1After day 1 the grid will be    2 2 1                                                  2 1 3                                                  3 1 1After day 2 the grid  will be  2 2 2                                                 2 2 3                                                 3 1 1 After day 3 the grid will be 2 2 2                                               2 2 3                                               3 2 1After day 4 the grid will be 2 2 2                                               2 2 3                                               3 2 2So, the minimum number of days is 4Input format:-Numbers of row in the gridNumbers of column in the gridContents of the grid(next row*column lines)Output format:-Minimum number of days required

On a street, there are N individuals (numbered from 1 to N) positioned along the line. Each person's position is denoted by Xi.Here's the situation: among these people, one person is unknowingly carrying the COVID-19 virus. The virus spreads if the distance between an infected person and a healthy person is no more than 2 units. As time goes on, a certain group of individuals (depending on who the initial infected person is) will become infected. Let's refer to the size of this group as the final count of infected people.Your goal is to print the smallest and largest possible number of people who could end up infected. This means finding the minimum and maximum counts of infected individuals, considering both the most favorable and the least favorable scenarios for how the virus spreads among the people on the street.Input FormatThe first line of each test case contains a single integer N.The second line contains N space-separated integers X1, X2, ..., XN.Constraints2 ≤ N ≤ 80 ≤ Xi ≤ 10 for each valid i0 ≤ X1 < X2 < ... < XNOutput FormatPrint a single line containing two space-separated integers ― the minimum and maximum possible final number of infected people.Sample Input 021 2Sample Output 02 2Sample Input 123 6Sample Output 11 1

On a street, there are N individuals (numbered from 1 to N) positioned along the line. Each person's position is denoted by Xi.Here's the situation: among these people, one person is unknowingly carrying the COVID-19 virus. The virus spreads if the distance between an infected person and a healthy person is no more than 2 units. As time goes on, a certain group of individuals (depending on who the initial infected person is) will become infected. Let's refer to the size of this group as the final count of infected people.Your goal is to print the smallest and largest possible number of people who could end up infected. This means finding the minimum and maximum counts of infected individuals, considering both the most favorable and the least favorable scenarios for how the virus spreads among the people on the street.Input FormatThe first line of each test case contains a single integer N.The second line contains N space-separated integers X1, X2, ..., XN.Constraints2 ≤ N ≤ 80 ≤ Xi ≤ 10 for each valid i0 ≤ X1 < X2 < ... < XNOutput FormatPrint a single line containing two space-separated integers ― the minimum and maximum possible final number of infected people.Sample Input 021 2Sample Output 02 2Sample Input 123 6Sample Output 11 1Contest ends in 5 hoursSubmissions: 375Max Score: 10Rate This Challenge: More C1#include <stdio.h>2#include <string.h>3#include <math.h>4#include <stdlib.h>5​6int main() {7​8    /* Enter your code here. Read input from STDIN. Print output to STDOUT */    9    return 0;10}11​

Use the following diagram. Assume that the horizontal lines in the diagramrepresent duration of illness in 8 different people, out of a community of 700.• Three people became ill in June. Of them, two recovered in July and one inAugust. Five additional persons became ill in July; two of them recovered thatmonth and three recovered in August

Suppose it takes 6 hours for a certain strain of bacteria to reproduce by dividing in half. If 40 bacteria are present to begin with, the total number present after 𝑥 days is𝑓⁡(𝑥)=40⋅16𝑥.Find the total number present after 1, 2, and 3 days.There will be bacteria present after 1 day, after 2 days and after 3 days.

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.