
Think together · First, a short story
The girl reads “choose at least two,” but the robot chooses only one. Its calculation may be fine, but it misunderstood the task.
Lay out the process
- Find the inputWhat are you given?
- Find the outputWhat exactly must you answer?
- Mark the conditionsAt least, at most, distinct
- Work through a sampleCheck your understanding
When reading a problem, restate its requirements in your own words.
Pay special attention to quantity limits, whether repetition is allowed, and whether the output asks for a value, a count, or a position. Working through a small example helps clarify the rules.
01Is the story the same as the actual task?
Many Olympiad problems use a story, but the algorithm handles the data relationships and rules behind it.
For example, “students queuing to buy tickets” may really mean: given several arrival times, calculate the processing order.
02What information should you mark while reading?
Input format
How many lines are there? What does each number represent?
Output format
How many values should you print, and in what format?
Constraints
n, value ranges, and time limit.
Special rules
What happens on ties? Are duplicates allowed?
03What is the difference between “at most,” “at least,” and “exactly”?
These words directly change the problem.
At least 3
3, 4, 5, and so on are all allowed.
Exactly 3
Only 3 is allowed.
Pay close attention to words that describe quantities.
04What can sample cases prove?
Samples help explain the rules and show that your program gives correct answers for those samples.
05Why are constraints part of the problem?
For example, n ≤ 20 and n ≤ 200000 may call for completely different algorithms.
Constraints are not extra details to check at the end; they are important clues about how the problem can be solved.
06How can you check that you really understand?
Try answering these questions:
- What am I given?
- What must I output?
- Which cases are valid?
- What counts as optimal or correct?
- How large can the input get?
What have you learned?
- Separate the story from the actual computation.
- Input, output, constraints, and special rules are all part of the problem.
- Key words can change the problem definition.
- Samples are examples, not a complete test suite.
- Constraints often hint at which algorithms are feasible.
Next: How can you turn a real-world problem into data?
Your turn to try
A problem asks for the position of the maximum value, but the program outputs only the value. Is that correct?
Ready? Open the explanation
No. It answers a different question. Record and output the requested position, and check whether positions start at 0 or 1.