ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1670. Asterisk

A subproblem
Posted by Igor Parfenov 17 Aug 2026 13:38
In my solution I had to solve following interesting subproblem.

Given an array. There is somewhere a unique cutpoint in this array. We don't know where, but we can check, if x is a cutpoint in O(1). We have to find this cutpoint, split array in two parts and do the same recursively on both parts. We need to do it faster than in O(n^2).

Solution:
For a segment (l, r) check for cutpoints in following order: l, r, l+1, r-1, l+2, r-2, ...