Given two zero-indexed arrays A and B consisting of N (N >= 0)
integers, which represent N fishes in a river, ordered from west to
east.
The fish are numbered from 0 to N-1, and Fish number X is represented
by A[X] and B[X]. Array A contains the sizes of the fishes, while array
B contains the directions they swim, which can be 1 (from west to east)
or -1 (from east to west).
If two fishes move in opposite directions meet each other, the larger
fish will eat the smaller one, and the survival will still follow its
original direction.
We assume that all fishes are in different sizes and swimming at the
same speed. The goal is to calculate the number of fishes that will stay alive.
For example:
A is [3, 5, 9, 1, 2]
B is [1, -1, 1, 1, -1]
Fish number 1 will eat Fish number 0, Fish number 4 will eat Fish
number 3 and be eaten by Fish number 2. Therefore the output should be 2
(Fish number 1 and Fish number 2 are still alive)