12744 - 電機資結 2020 HW2 COVID-19 Simulation
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
| Case 6 |
1 sec |
32 MB |
| Case 7 |
1 sec |
32 MB |
| Case 8 |
1 sec |
32 MB |
| Case 9 |
1 sec |
32 MB |
| Case 10 |
1 sec |
32 MB |
Description
- The simulation takes place in one matrix r_1 * c_1 and an ICU list with capacity k
- Initially, people will be placed in the matrix
- Either healthy, masked, or sick (i.e., tested positive for COVID-19)
- It will be very sparse at the beginning
- People will be inserted into the regular matrix from time to time. The following sequence is an example, in which four people are inserted into the matrix at day 4, 5, 8, and 8 respectively, and their coordinates are (101, 33), (101, 34), (53, 21), and (101, 32), respectively.
- 4 101 33 Alice Healthy
- 5 101 34 Bob Masked
- 8 53 21 Xeno Sick
- 8 101 32 John Sick
- Healthy people with mask will remain healthy
- Healthy people without masks will be infected by ill people in the orthogonally adjacent (上下左右緊鄰) cells.
- For example, in the above example, Alice will be infected by John at day 8 and become sick at day 9
- Initially, the recovery time for all sick people is 14 days.
- Every sick neighbor will increase recovery time by 7 days.
- For example, at day 9, Alice recovery time is 14+7 days (since John next to her).
- Assume at day 10, Alice has another sick neighbor, her recover time will be (21-1)+7 days
- A sick person should be moved to ICU, only if:
- The recovery time is more than 28 days
- For example, at day 10, Alice recovery time is 27 days, she will not sent to ICU
- For another example, at time T=11, Alice has another sick neighbor, her recovery time becomes (27-1)+7, she will be sent to ICU at t=11 (if none in the ICU yet)
- Once the people are moved to ICU, he/she will be there till the end
- For example, Alice will become the survivor till the end but will stay in ICU forever.
- When sick people successively surrounded by more than three other sick people for more than 7 days will die.
- When a person die, the cell becomes empty and blocked.
- The simulator needs to print:
- The survivor rate in the end
- The names of survivors (who are not in ICU)

Input

Output

Tags
qq
@@