Skip to content
Tactiverge

Olympiad · Practice · public practice problem

Growth detective

Difficulty 4 of 510 points in 4 partsSuggested time ~20 min (never timed here)

The problem

A collision checker compares every pair of obstacles:

count = 0
for i in range(n):
    for j in range(i + 1, n):
        count += 1

On one laptop, a pair-checking routine takes 0.8 s at n = 2000. A rewrite takes 0.8 s at n = 2000 and 3.7 s at n = 8000.

  1. Part (a) · 3 points

    What is count when n = 50?

    (pure number)Tolerance: exact

  2. Part (b) · 2 points

    If the original routine is O(n²), predict its time at n = 8000.

    sTolerance: ±1 %

  3. Part (c) · 3 points

    If instead it were O(n log n), predict its time at n = 8000.

    sTolerance: ±1 %

  4. Part (d) · 2 points

    Which growth law best fits the rewrite's measurements?

Checked so far: 0 of 10 automatically marked points. Nothing is saved.

Stuck? Hints, then the worked solution

Written with AI assistance. Review status: technically-checked (answers recomputed independently with units verified by automated tests); not yet reviewed by an educator or judge.