Ants on a Stick

The problem
1 m stick · ants at 1 m/s · reverse on collision0 m1 mlongest time until all have fallen off?

A bunch of ants sit on a one-meter stick at random positions, each facing left or right. They all walk at exactly 1 m/s. Rules:

  • When two ants meet head-on, both reverse direction.
  • When an ant reaches an end, it falls off.

In the worst case (any number of ants, any positions, any starting directions), how long until all ants have fallen off?