Problem Statement.

As far as D1-250's go, this was a pretty simple one. The only starting values for the amoeba are the values in

Now, create another set, **final**, with potential final values.
For each
initial value in **initial**, simulate the
the amoeba with that value. Calculate the ending
value of the amoeba, and put it into **final**. At the end, you can run through
**initial** again, and count the number of elements that are not also in **final**.
That's the answer.

Let's look at examples:

Example | X |
initial |
final |
Answer |

0 | {3, 2, 1} |
{1, 2, 3} |
{2, 4, 6} |
2 |

1 | {2, 2, 2, 2, 2, 2, 4, 2, 2, 2} |
{2, 4} |
{8} |
2 |

2 | {1, 2, 4, 8, 16, 32, 64, 128, 256, 1024, 2048} |
{1, 2, 4, 8, 16, 32, 64, 128, 256, 1024, 2048} |
{512, 4096} |
11 |

3 | {854, 250, 934, 1000, 281, 250, 281, 467, 854, 562, 934, 1000, 854, 500, 562} |
{250, 281, 467, 500, 562, 854, 934, 1000} |
{1000, 1124, 1708, 1868, 2000} |
7 |

The running time complexity of this is *O(n ^{2})*, where

- Creating
**initial**is*O(n*log(n))*. The size of**initial**in the worst case is*n*. - Simulating an amoeba takes
*O(n)*time, because you have to traverse all of vector*X*. - Traversing
**initial**is*O(*, which means that in the worst case, it is**initial.size()**)*O(n)*. - Therefore, simulating all of the amoebas in
**initial**will take*O(n*.^{2}) - Inserting each result into
**final**is*O(log(n))*. - So, inserting all of the results into
**final**is*O(n*log(n))*. - The dominant term here is
*O(n*, so that is the running time.^{2})