← CSES Better

Target Practice

USACO · 2023 · December · silver-3

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

strings · simulation

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

sample trace

Target Practice: strings walkthrough

Target Practice: use the linked editorial?s strings, simulation idea on the published sample, then verify the displayed output.

Published input3 7 0 -1 1 LFFRFRR 1 5 0 FFFFF 5 6 1 2 3 4 5 FFRFRFmodelAlgorithm ideaTreat the text as an ordered sequence of characters and use the editorial?s matching or prefix/suffix property to avoid rescanning.task resultExpected output3 1 3
  1. 1

    Scan

    Process characters in order while maintaining the relevant prefix or match state.
  2. 2

    Match

    Use the editorial?s string property to detect or extend a valid pattern.
  3. 3

    Finish

    Convert the resulting match or transformed sequence into the requested 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.