P6056 [Cheer Up Wuhan] SIR Model

Background

The SIR model divides the total population into the following three categories: - Susceptibles, denoted as $s(t)$, representing the number of people at time $t$ who are not infected but may be infected by this disease. - Infectives, denoted as $i(t)$, representing the number of people at time $t$ who have been infected, are patients, and are contagious. - Recovered, denoted as $r(t)$, representing the number of people at time $t$ who have been removed from the infectives group. Let the total population be $N(t)$, then $N(t)=s(t)+i(t)+r(t)$. The SIR model is built based on the following three assumptions: 1. Population dynamics such as births, deaths, and migration are not considered. The population always remains a constant, i.e., $N(t) \equiv K$. 2. Once a patient comes into contact with susceptibles, they will certainly have some infectiousness. Assume that at time $t$, within one unit of time, the number of susceptibles that one patient can infect is proportional to the total number of susceptibles in the environment $s(t)$, with proportionality coefficient $\beta$. Therefore, at time $t$, within one unit of time, the number of people infected by all patients is $\beta s(t)i(t)$. 3. At time $t$, within one unit of time, the number of people removed from the infectives group is proportional to the number of patients, with proportionality coefficient $\gamma$. The number of removed people within one unit of time is $\gamma i(t)$.

Description

We simplify this model. Initially, there are $I$ infectives and $S$ susceptibles. For each day, suppose there are currently $I_i$ infectives, $S_i$ susceptibles, and $R_i$ recovered. Then each day, $\lceil \beta S_iI_i \rceil$ people will be infected (changing from susceptible to infective), and $\lceil \gamma I_i \rceil$ people will be cured (changing from infective to recovered). Here, $\beta$ is the infection rate, $\gamma$ is the recovery rate, and $\lceil \ \rceil$ is the ceiling function. Find how many susceptibles $S$, infectives $I$, and recovered $R$ there are after $n$ days. Note: Infectives and recovered are settled daily, and the result depends only on the values at the start of that day. That is, someone who recovers on that day does not affect how many people they infect on the same day. If the computed number of newly infected people exceeds the number of susceptibles, then all susceptibles become infected.

Input Format

The first line contains three positive integers, representing the number of susceptibles on day $0$, $S_0$, the number of infectives on day $0$, $I_0$, and the number of days $n$ (initially the number of recovered is $R_0=0$). The second line contains two floating-point numbers, representing the infection rate $\beta$ and the recovery rate $\gamma$.

Output Format

Output one line with three integers, representing the numbers of susceptibles $S$, infectives $I$, and recovered $R$ after $n$ days.

Explanation/Hint

For $30\%$ of the testdata, $n=1$. For another $30\%$ of the testdata, $S_0, R_0 \le 10^4$. For $100\%$ of the testdata, $1 \le S_0+R_0 \le 2\times 10^9, 0 < \beta, \gamma < 1, 1 \le n \le 100$. Translated by ChatGPT 5