Issue # 33: IT training – current issues and challenges from leading companies

4 min


Hello! Who has what quarantine day? Side force coronavarius – he killed all the other news. And all the other news, as you know, is bad, so this is good news.

In general, we consulted and decided this week to propose puzzles on the topic of … viruses

Calmly, you can’t get infected through their decisions.

Wash your hands, stay at home, do not touch your face, wait for answers to the problems exactly one week later.

P.S. Answers to problems from the previous issue have already been published.

Questions

1. Diseases and tests

Dinoo is worried that he might have a rare disease. He decides to get himself tested, and suppose that the testing methods for this disease are correct 99 percent of the time (in other words, if he has the disease, it shows that he does with 99 percent probability, and if he doesn’t have the disease, it shows that he does not with 99 percent probability). Suppose this disease is actually quite rare, occurring randomly in the general population in only one of every 10,000 people.
If his test results come back positive, what are his chances that he actually have the disease?

A. 0.99
B. 0 .90
C. 0.10
D. 0.01

Transfer

Dinu worries that he may have a rare disease. He decides to undergo testing and assumes that testing methods for this disease are correct in 99 percent of cases (in other words, if he has a disease, the test will show that he is sick with a 99 percent probability, and if he does not have the disease, the test will show that he’s not sick with a 99 percent probability). Suppose that this disease is actually quite rare, accidentally occurring in the general population in only one out of every 10,000 people.
If the results of his tests are positive, what are his chances that he is really sick with this disease?

2. Strict Pill Schedule Problem

You are on a strict medical regimen that requires you to take two types of pills each day. You must take exactly one A pill and exactly one B pill at the same time. The pills are very expensive, and you don’t want to waste any. So you open the bottle of A pills and tap one out into your hand. Then you open the bottle of B pills and do the same thing – but you make a mistake, and two B pills come out into your hand with the A pill. But the pills are all exactly identical. There is no way to tell A pills apart from B pills. Is it possible to satisfy your regimen and take exactly one of each pill at the same time, without wasting any pills?

Transfer

You are on a strict medical regimen, which requires you to take two types of tablets every day. You must take exactly one tablet A and exactly one tablet B at a time. Pills are very expensive and you do not want to waste them. So, you open a bottle of tablets A and shake one of them in your palm. Then you open the bottle of tablets B and do the same – but you are mistaken, and two tablets B are poured into your hand with tablet A. But the tablets are all exactly the same. There is no way to distinguish tablets A from tablets B. Is it possible in this case to observe one’s own regimen and take exactly one tablet at a time without wasting tablets?

Tasks

1. The virus challenge in a bacterial colony

One virus enters a colony consisting of N bacteria. In the first minute, it destroys one bacterium, then divides into two new viruses. At the same time, each of the remaining bacteria is also divided into two new ones. The next minute, the two viruses that emerge destroy the two bacteria, and then both viruses and all the remaining bacteria divide again and so on.

Will this colony live forever under the indicated conditions or will it die in the end?

2. Sort the way!

A new deadly virus has infected large population of a planet. A brilliant scientist has discovered a new strain of virus which can cure this disease. Vaccine produced from this virus has various strength depending on midichlorians count. A person is cured only if midichlorians count in vaccine batch is more than midichlorians count of person. A doctor receives a new set of report which contains midichlorians count of each infected patient, Practo stores all vaccine doctor has and their midichlorians count. You need to determine if doctor can save all patients with the vaccines he has. The number of vaccines and patients are equal.

Input Format:

First line No of test cases t followed by contains the number of vaccines – N. Second line contains N integers, which are strength of vaccines. Third line contains N integers, which are midichlorians count of patients.

Output Format:

Print a single line containing ′ 1 ′ for Yes or ‘0’ for No.

Constraints:
1<=T<=150
1<=N<=10

Strength of vaccines and midichlorians count of patients fit in integer.

Sample Input:
2
5
123 146 454 542 456
100 328 248 689 200
8
87 93 50 22 63 28 91 60
64 27 41 27 73 37 12 69

Sample Output:
0

Transfer

A new deadly virus has infected a large population of the planet. The scientist discovered a new strain of the virus that can cure this disease. The vaccine obtained from this virus has a different potency depending on the amount of midichlorian. A person can be cured only if the number of midi-chlorians in the vaccine lot is greater than the number of midi-chlorians in a person. The doctor receives a new set of reports, which contains the number of midi-chlorians of each infected patient, Practo stores all the vaccines that the doctor has, and their number of midi-chlorians. You need to determine if the doctor can save all patients with the vaccines that he has. The number of vaccines and patients is the same.

Input format:

The first line contains the number of tests t, followed by the number of vaccines - N. The second line contains N integers, which are the strength of the vaccines. The third line contains N integers, which are the amount of midichlorian in patients.

Output format:

Print a single line containing "1" for yes or "0" for no.

Limitations:
1<=T<=150
1<=N<=10

The strength of the vaccines and the number of midi-chlorians in patients fit into an integer.

Sample input:
2
5
123 146 454 542 456
100 328 248 689 200
8
87 93 50 22 63 28 91 60
64 27 41 27 73 37 12 69

Output Example:
0

Answers to the tasks will be given during the next week - have time to solve it. Good luck


0 Comments

Leave a Reply