Practice: Complexity and limits
0 of 4 solved
About these problems
Apply, Connect, Reason and Stretch describe difficulty within this topic, not an official contest rating. Open any problem in any order; reading the chapter first is optional.
- 1Square budgetA routine performs exactly n×n operations, and a machine budget allows at most b operations. Print YES if the routine fits within the budget (n×n ≤ b), otherwise print NO.ApplyNot started
- 2Pair iterationsA loop visits every pair of positions i, j with 1 ≤ i < j ≤ n exactly once. Print how many iterations it performs.ConnectNot started
- 3Halving logStart with x = n. While x > 0, record one operation and replace x by floor(x/2), which is x divided by 2 and rounded down. Print the number of recorded operations.ReasonNot started
- 4Batch pair workloadThere are t independent batches of items, described by a list of t integers n1, n2, ..., nt, where batch i contains ni items. Within each batch, a routine compares every unordered pair of different items exactly once. Items in different batches are never compared. Print the total number of comparisons across all batches.StretchNot started