Beat The Flu
All submissions for this problem are available.
The Health Minister of India has decided to set up screening centers to fight the outbreak of swine flu in 'T' towns, where 'T' is an integer which is neither greater than 35 nor less than 3.'S' pairs of these towns are connected by direct routes. The Ministry decides to set up these centers to ensure that for any town 'T', there will be a screening center located either in the town itself or in its adjacent town.Your task in this question is to help the Health Minister set up minimum number of screening centers as per above mentioned criteria.
The first line of input consists of the number of test cases (atleast 1 and not exceeding 50) followed by a blank line. The next line will consist of number of towns 'T' (1<=T<=20) and the total number of routes 'S' (0<=S<=[n*(n-1)/2])connecting the towns, seperated by a space. Each of the next S lines contains the towns which are connected, at one pair per line with each pair separated by space. Your input ends with T = 0 and S = 0. The input for the town not connected to any town is NOT given.
For each input case, print a line reporting the minimum number of Screening centers needed. You also have to check for erroneous cases.In case any error is detected, just print "error" for that input.
Sample Input: 2 8 12 1 2 1 6 1 8 2 3 2 6 3 4 3 5 4 5 4 7 5 6 6 7 6 8 0 0 9 11 1 2 1 6 2 1 2 3 3 4 4 9 5 7 6 8 7 8 7 9 8 9 0 0 Sample Output: 2 Error (You Don't have to print this but the error in the second case is that the path 1 2 is same as 2 1 which is repeated.)
|Time Limit:||3 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, PYTH 3.6, PYPY, GO, NODEJS, rust, swift, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.