Skip to content

Commit

Permalink
Merge pull request #5039 from JoltedCowIceCream/patch-6
Browse files Browse the repository at this point in the history
Why Did the Cow Cross the Road Editorial
  • Loading branch information
SansPapyrus683 authored Jan 15, 2025
2 parents a1e2282 + e1fcff9 commit 9efa56b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions solutions/silver/usaco-714.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
id: usaco-714
source: USACO Silver 2017 February
title: Why Did the Cow Cross the Road I
author: Benjamin Qi, Brad Ma
author: Benjamin Qi, Brad Ma, David Guo
---

[Official Analysis (C++)](http://www.usaco.org/current/data/sol_helpcross_silver_feb17.html)

There are multiple greedy strategies (though all of them involve
sorting the animals by time). Here, we follow the approach described by the
analysis.
## Explanation

Let’s focus on the chicken with the earliest time preference for helping a cow. If no cow needs to cross the road at that time, we can disregard this chicken. However, if there are cows that need to cross at that time, we have some options for assigning the chicken. Intuitively, we should assign this chicken to the cow whose crossing time window ends the earliest. This approach maximizes flexibility for assigning other chickens to cows later.

## Implementation

Expand Down

0 comments on commit 9efa56b

Please sign in to comment.