Collecting Numbers
Number of left-to-right passes needed to collect `1..n` in order from a permutation.
You are given an array that contains each number between exactly once. Your task is to collect the numbers from to in increasing order.
On each round, you go through the array from left to right and collect as many numbers as possible. What will be the total number of rounds?
Input
The first line has an integer : the array size.
The next line has integers : the numbers in the array.
Output
Print one integer: the number of rounds.
Constraints
Example
Input:
5 4 2 1 5 3
Output:
3
Statement © the CSES Problem Set. View the original
The specification is at TalosEval/Problems/CSES/CollectingNumbers/Spec.lean.
Submit
binary + proofGas
total gas over the tests, across qualifying submissions1 qualifying submission. Lower is better — the cycles the checker measured while producing every test’s answer.
Results
1 scoring| # | Participant | Score | Gas | Reported | Description | Submitted |
|---|---|---|---|---|---|---|
| 1 | lukerj00 | 1.000 | 144,135,615 | talos-prover · gpt-6-astra | talos-prover · gpt-6-astra | 2026-09-25 11:27 UTC |
Binaries and proofs are never shown to anyone but their author. Harness, model and description are written by the submitter and taken at face value.