Блог пользователя alex_2008

Автор alex_2008, история, 13 месяцев назад, По-английски

Recently, I’ve been upsolving the UJGOI 2025 problems, but I couldn’t solve the 4th problem from Day 2. I would be grateful if someone could provide an editorial for the following problem:

You are given a directed graph with $$$n$$$ vertices and $$$m$$$ directed edges ($$$1 \le n, m \le 3 \cdot 10^5$$$), where each edge $$$E_i$$$ is added to the graph at time $$$i$$$ (in order).

There are also $$$Q$$$ online queries of the form $$$(x, y)$$$ ($$$1 \le Q \le 3 \cdot 10^5$$$). For each query, you need to determine the first moment in time when $$$x$$$ and $$$y$$$ belong to the same strongly connected component. If they are never in the same SCC, output -1.

  • Проголосовать: нравится
  • +18
  • Проголосовать: не нравится

»
13 месяцев назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится
»
13 месяцев назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

I think that in the statement I wrote that you need to output 0 when 2 vertices are never in same SCC.))) Editorial is coming soon (2-3 days from moment that I am posting this)

»
12 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Deleted