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

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.

PS 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
, . , 99 ( , , , 99- , , , 99- ). , , 10 000 .
, , ?

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
, . A B . , . , A . – , B . . A B. , ?

Tasks


1. The virus problem 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 spawn destroy two bacteria, and then both viruses and all remaining bacteria divide again and so on.

Under this conditions, will this colony live indefinitely, 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

. , . , , . , , . , , Practo , , . , , . .

:
t, β€” N. N , . N , .

:
, Β«1Β» Β«0Β» .

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

.

:
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


:
0


1
D β€” , , 1 .

:
() , . , ? , , ?

, A B, P (A|B) B A, P (B|A) A B:
P(A|B) = P(A)P(B|A) / P(B) => P(B) = P(A)P(B|A)/P(A/B)
  • β€” , , β€” , .
  • , P(B|not A) β€” β€œ ”: , . P (B|A)=0.99, P (A)=0.0001, P (B) , A :
    P(B)=P(B|A)P(A)+P(B|not A)P(not A) 0.99*0.0001+0.01*0.9999.
    , , , 1 .

, , , , , . , , 1 . 100 , 99 . 999 900 , 9999 ( , - ). , , , , 99/(99+9999), , 0.0098 1 !

2
:
1: .

2: , , .

3: , .

4: . , ( ).

1
: .

. , :


, t = N .

2
#include<iostream>
using namespace std;
int main()
 {
	int t;
	cin>>t;
	while(t--)
	{
	    int n,p=1;
	    cin>>n;
	    int a[n],b[n];
	    for(int i=0;i<n;i++)
	    cin>>a[i];
	    for(int i=0;i<n;i++)
	    cin>>b[i];
	    sort(a,a+n);
	    sort(b,b+n);
	    for(int i=0;i<n&&p;i++)
	    if(a[i]<b[i])
	    p=0;
	    cout<<p<<"\n";
	}
	//code
	return 0;
}

All Articles