Skip to content

USACO 2026 (Bronze)

From mid-March to early April we used real USACO 2026 Bronze contests to practise reading carefully, handling corner cases and optimising a brute force. This page collects what we discussed; the statements are on usaco.org.

Lesson Contest Focus
18 March Contest 3 (full review) Liam solved all problems apart from one small typo; time-complexity table
22 March Contest 2 · Purchasing Milk powers of two, bit operations, sum constraints
29 March, 1 April the rectangle-sum problem (last problem of Contest 2) brute force first, then update only what changes
5 April Contest 1 statement details and corner cases

Contest 2

Contest page: USACO 2026 Contest 2 results

It's Mooin' Time IV

Problem 1563

Hint from our homework sheet (22 March)

Think about the last keystroke first. The last character Bessie types must be exactly the last character of the final string. Then work backward from right to left and only track whether the total number of future flips is even or odd.

Moo Hunt

Problem 1564

Hint from our homework sheet (22 March)

Since \(N \le 20\), the number of possible boards is only \(2^N\), which is manageable. Represent each board with a bitmask, where each bit tells you whether that position is M or O, and evaluate the score of every board.

See Bitmasks & Bit Operations.

Purchasing Milk

Problem 1565

What we worked out in class on 22 March: the deal sizes are powers of two, so prices can be improved in both directions.

  1. Several copies of a smaller deal can replace a larger one, so a larger deal never needs to cost more than two of the previous size.
  2. It is allowed to buy more than needed, so sometimes one larger deal is cheaper than exactly covering a small remainder.

After these two fixes the rest is the binary decomposition of the target amount.

Hint from our homework sheet (22 March)

First preprocess the prices so that a larger deal is never worse than buying two of the previous smaller deal. Then greedily process deals from large to small, like binary decomposition, while also checking whether buying one extra larger deal is cheaper than matching the amount exactly.

The rectangle-sum problem (29 March and 1 April)

The lessons followed make it work, make it fast, then make it pretty:

  1. Work: ignore the limits and write a brute force. Fix the top-left corner of each rectangle and loop over the offsets to add up its cells. It passed 6 of 12 tests, which confirmed that our reading of the problem was right.
  2. Fast: after an update +v, only the rectangles containing that cell change, at most \(k^2\) of them. Store every rectangle's sum and update just those. Since \(v \ge 1\), the best sum never decreases, so one running maximum is enough.
  3. The real statement (1 April): an update replaces a value instead of adding to it. Remove the old contribution and add the new one, or equivalently add delta = new - old, which turns it back into the additive version.

See also Integer Types & Overflow for the size() pitfall from the same lesson.

Contest 1

Problems given as homework on 1 April and discussed on 5 April:

Problem Link
Chip Exchange 1539
COW Splits 1540
Photoshoot 1541

The difficulty in this set was mostly corner cases and precise implementation rather than a new trick: slow down, list the edge cases, and finish the steps one by one. The second half of that lesson started binary search.


Credits & sources

Problems © USACO, linked not copied. The three hints are quoted from our homework sheet of 22 March; the summaries of the lessons are ours.