If type it implies that person a and person b came in contact with each other at time T-1. At the moment all contacts of a and each of b are merged to form a single large group where each pair can be considered a contact of each other. Note that any two people can come in contact such that one of them is infected while the other is neither infected nor vaccinated. The virus affects a person who has already caught the virus or a person who is already vaccinated. Note that the value for b is not important in this case. Initially, no two people are in contact with each other and everyone throughout put - corresponding to that person is vaccinated. Find the time at which each of the n people is infected.
Example: n=6, m=3, number of updates = t, infected = [0,3,1,1,1,2,1,1,4,1,1,1,2,5,0,3,4,2,1,5]
At time t=0, person 0 and person 3 are infected. The updates happen as follows:
At time t=1, person 0 and person 3 come in contact. Since both are already infected, nothing happens. There are 5 contact groups: [0],[3],[4],[5].
At time t=2, person 0 and person 4 come in contact. Now there are 4 contact groups: [0,3],[4],[2,1],[5]. Since person 0 is infected and person 4 is neither infected nor vaccinated, person 4 gets infected at time t=2.
At time t=3, person 2 and person 5 come in contact. Now there are 3 contact groups: [0,3,4],[2,1],[5]. Since person 2 and person 5 are both uninfected, nothing happens.