← CSES Better

It's Mooin' Time

USACO · 2024 · December · platinum-2

Open official problem ↗
Ask AI

Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.

Open Claude Desktop

greedy · graph-algorithms · sorting

The organizer’s problem statement is available at the official source link.

sample trace

It's Mooin' Time: greedy walkthrough

It's Mooin' Time: use the linked editorial?s greedy, graph algorithms idea on the published sample, then verify the displayed output.

Published input1 4 MOOO 10 20 30 40 3 4 OOOO 50 40 30 20 2 20 OOOMOMOOOMOOOMMMOMOO 44743602 39649528 94028117 50811780 97338107 30426846 94909807 22669835 78498782 18004278 16633124 24711234 90542888 88490759 12851185 74589289 54413775 21184626 97688928 10497142 3 20 OOOMOMOOOMOOOMMMOMOO 44743602 39649528 94028117 50811780 97338107 30426846 94909807 22669835 78498782 18004278 16633124 24711234 90542888 88490759 12851185 74589289 54413775 21184626 97688928 10497142modelAlgorithm ideaProcess choices in the order justified by the editorial and maintain the invariant that each accepted choice remains safe.task resultExpected output0 20 50 90 40 0 0 0 0 0 12851185 35521020 60232254 99881782 952304708 0 0 0 44743602 119332891 207066974
  1. 1

    Order

    Arrange candidates by the criterion used by the task?s greedy strategy.
  2. 2

    Choose

    Accept the next locally safe option while preserving the feasibility invariant.
  3. 3

    Finish

    Read the accumulated result and check it against the sample output.
  4. 4

    Verify the sample

    Use the published sample output to check the result of this idea on the displayed input.
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|12 lines, 156 chars

Run output

Run your code to see output.