Help with editorial

Could anybody please explain to me this part of the solution of the Milk Measurement USACO Bronze Question?

I am not understanding these 2 parts of the solution:

bool is_highest(int c, int d)
{
   int highest = max(max(rates[0][d], rates[1][d]), rates[2][d]);
   return rates[c][d] == highest;
}

and

  for (int d=1; d<=100; d++) {
    if (is_highest(0,d-1) != is_highest(0,d) || is_highest(1,d-1) != is_highest(1,d) || is_highest(2,d-1) != is_highest(2,d))
       num_changes++;

}

The first code snippet (is_highest) checks if the cow (int c) has the highest milk output on the given day (int d).
The second snippet checks if the cow who has the highest milk output has changed, by comparing the previous day’s leader to the current day’s leader.

1 Like