OpenGenus / cosmos

World's largest Contributor driven code dataset | Used in Quark Search Engine, @OpenGenus IQ, OpenGenus Visual Project
http://internship.opengenus.org
GNU General Public License v3.0
13.58k stars 3.69k forks source link

Codechef Coronavirus Spread in C++ #5601

Open shivani789 opened 4 years ago

shivani789 commented 4 years ago

Problem Link Coronavirus Spread

Details: There are N people on a street (numbered 1 through N). For simplicity, we'll view them as points on a line. For each valid i, the position of the i-th person is Xi.

It turns out that exactly one of these people is infected with the virus COVID-19, but we do not know which one. The virus will spread from an infected person to a non-infected person whenever the distance between them is at most 2. If we wait long enough, a specific set of people (depending on the person that was infected initially) will become infected; let's call the size of this set the final number of infected people.

Your task is to find the smallest and largest value of the final number of infected people, i.e. this number in the best and in the worst possible scenario.

shivani789 commented 4 years ago

Please assign this issue to me.

Rchang222 commented 4 years ago

I'm interesting in working on this if it has yet to be implemented. Please advise!