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 1651. Shortest Subchain

Could anyone provide me with an O(n) solution? My works O(n log(n))
Posted by Sq1 5 Jan 2017 21:36
Could anyone provide me with an O(n) solution? My works O(n log(n))
Re: Could anyone provide me with an O(n) solution? My works O(n log(n))
Posted by Solver 8 Jun 2026 15:30
BFS for shortest path, but not over original graph - over the chain itself. There are edges of weight 1 and 0.