#P6056. Epidemic Simulation Model

    ID: 19280 Type: Default 1000ms 256MiB

Epidemic Simulation Model

Epidemic Simulation Model

This problem simulates a simplified epidemic model. Initially, there are S susceptible individuals and I infected individuals (with R = 0 recovered individuals). For each day i with Si susceptible, Ii infected, and Ri recovered individuals, the following updates occur:

New infections: \(\lceil \beta \; S_i \; I_i \rceil\)

New recoveries: \(\lceil \gamma \; I_i \rceil\)

Note: If the calculated number of new infections exceeds the current number of susceptible individuals, all susceptible individuals become infected. Also, the day's infection and recovery counts are computed based on the counts at the beginning of the day. That is, individuals who recover on the same day will still count as infecting others on that day.

You are given the number of days n to simulate and the parameters. After simulating for n days, output three integers representing the final number of susceptible (S), infected (I), and recovered (R) individuals, respectively.

inputFormat

The input consists of a single line containing 5 values separated by spaces:

  • n – the number of days to simulate (an integer)
  • S – the initial number of susceptible individuals (an integer)
  • I – the initial number of infected individuals (an integer)
  • beta – the infection coefficient (a floating-point number)
  • gamma – the recovery coefficient (a floating-point number)

Initially, the number of recovered individuals R is 0.

outputFormat

Output a single line containing three space-separated integers representing the final number of susceptible (S), infected (I), and recovered (R) individuals after n days.

sample

1 100 1 0.001 0.1
99 1 1