Question in Modern Art 2

Why is the beginning and end of the colors array padded with zeroes, and why do they affect the implementation?

http://www.usaco.org/current/data/sol_art2_gold_open17.html