Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktopgreedy · graph-algorithms
The organizer’s problem statement is available at the official source link.
sample trace
Custodial Cleanup: greedy walkthrough
Custodial Cleanup: use the linked editorial?s greedy, graph algorithms idea on the published sample, then verify the displayed output.
Published input2
5 5
4 3 2 4 3
3 4 3 4 2
2 3 4 4 3
1 2
2 3
3 1
4 1
4 5
4 3
3 2 4 1
2 3 4 4
4 2 3 4
4 2
4 1
4 3
5
2 0
1 2
2 2
2 2
2 1
1 1
2 1
2 1
1 2
2 1
1 1
2 1
1 2
1 2
2 1
1 1
1 2
2 1
1 2
5 4
1 2 3 4 4
2 3 5 4 2
5 3 2 4 2
1 2
1 3
1 4
4 5modelAlgorithm ideaProcess choices in the order justified by the editorial and maintain the invariant that each accepted choice remains safe.task resultExpected outputYES
NO
YES
YES
NO
YES
NO
- 1
Order
Arrange candidates by the criterion used by the task?s greedy strategy. - 2
Choose
Accept the next locally safe option while preserving the feasibility invariant. - 3
Finish
Read the accumulated result and check it against the sample output. - 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 charsRun output
Run your code to see output.