Under construction

Still being built. Things may change

Hares and Foxes

Time limit1sMemory limit128 MB

Summary
Given a linear recurrence matrix for hare and fox population differences, classify the long-term limiting behavior of the system into one of six fixed outcomes based on eigenvalue analysis.
Level

Medium7 of 10

Topics
Math, Matrix, Simulation
Solved
No attempts yet

Problem

A theatre company stages a comedy in which many animals appear. To make the play as realistic as possible, a specialist studies how the animals behave, and he is currently interested in a two-species dynamic ecological system of hares and foxes. You are asked to build an automatic simulator that predicts the long-term fate of this system.

The system evolves according to the following standard model, a pair of difference equations:

hy+1=ahy−bfyh_{y+1} = a h_y - b f_y fy+1=cfy+dhyf_{y+1} = c f_y + d h_y

Here hyh_y and fyf_y are the differences between the hare and fox populations in year yy and a reference count fixed at the start of the experiment. Their units are unknown, so hyh_y and fyf_y are treated as real numbers. Starting from the year-1998 values h1998h_{1998} and f1998f_{1998}, determine the long-term evolution of the system.

Input

The input contains NN test cases. The first line holds the single positive integer NN. Each case then gives six real numbers a,b,c,d,h1998,f1998a, b, c, d, h_{1998}, f_{1998} in this order, on three lines with two numbers per line, separated by one or more spaces. Each number uses the classical format (an optional sign, a sequence of digits, an optional decimal point, and an optional sequence of digits), and its text form is at most 10 characters long.

Output

For each case, print exactly one of the following sentences:

  • Ecological balance will develop. — if, after a sufficiently long time, both populations approach the reference count with arbitrary given precision, that is lim⁡hy=0\lim h_y = 0 and lim⁡fy=0\lim f_y = 0.
  • Hares will die out while foxes will overgrow. — if lim⁡hy=−∞\lim h_y = -\infty and lim⁡fy=+∞\lim f_y = +\infty.
  • Hares will overgrow while foxes will die out. — if lim⁡hy=+∞\lim h_y = +\infty and lim⁡fy=−∞\lim f_y = -\infty.
  • Both hares and foxes will die out. — if lim⁡hy=−∞\lim h_y = -\infty and lim⁡fy=−∞\lim f_y = -\infty.
  • Both hares and foxes will overgrow. — if lim⁡hy=+∞\lim h_y = +\infty and lim⁡fy=+∞\lim f_y = +\infty.
  • Chaos will develop. — if none of the above descriptions fits.

Examples5

  1. Example 1

    Input
    2
    2 0.5
    0.5 0.6
    2 3
    
    0.1 1 
    2 0.1
    1 1
    
    Expected output
    Both hares and foxes will overgrow.
    Hares will die out while foxes will overgrow.
    
  2. Example 2

    Input
    1
    0.5 0.1
    0.3 0.05
    3 2
    
    Expected output
    Ecological balance will develop.
    
  3. Example 3

    Input
    1
    2 0.5
    0.5 0.6
    -2 -3
    
    Expected output
    Both hares and foxes will die out.
    
  4. Example 4

    Input
    1
    0.1 1
    2 0.1
    -1 -1
    
    Expected output
    Hares will overgrow while foxes will die out.
    
  5. Example 5

    Input
    1
    0.5 2
    0.5 2
    1 1
    
    Expected output
    Chaos will develop.