No Time to Paint USACO 2021 January Contest

No Time to Paint USACO Solution Bessie has recently received a painting set, and she wants to paint the long fence at one end of her pasture. The fence consists of NN consecutive 1-meter segments (1≤N≤1051≤N≤105). Bessie has 26 different colors available, which she labels with the letters ‘A’ through ‘Z’ in increasing order of darkness (‘A’ … Read more

Spaced Out USACO 2021 January Contest

Spaced Out USACO Solution Farmer John wants to take a picture of his cows grazing in their pasture to hang on his wall. The pasture is represented by an NN by NN grid of square cells (picture an N×NN×N chess board), with 2≤N≤10002≤N≤1000. In the last picture Farmer John took, his cows were too clumped together in one region of the pasture. … Read more

Even More Odd Photos USACO 2021 January Contest

Even More Odd Photos USACO Solution Farmer John is yet again trying to take a photograph of his NN cows (2≤N≤10002≤N≤1000). Each cow has an integer “breed ID” number in the range 1…1001…100. Farmer John has a very peculiar idea in mind for his photo: he wants to partition all the cows into disjoint groups (in other words, … Read more

Just Stalling USACO 2021 January Contest

Just Stalling USACO Solution Farmer John has NN cows (1≤N≤201≤N≤20) of heights a1…aNa1…aN. His barn has NN stalls with max height limits b1…bNb1…bN (so for example, if b5=17b5=17, then a cow of height at most 1717 can reside in stall 55). In how many distinct ways can Farmer John arrange his cows so that each cow is in a different stall, and so that the height … Read more

Uddered but not Herd USACO 2021 January Contest

Uddered but not Herd USACO Solution A little known fact about cows is that they have their own version of the alphabet, the “cowphabet”. It consists of the 26 letters ‘a’ through ‘z’, but when a cow speaks the cowphabet, she lists these letters in a specific ordering that might be different from the order … Read more