UJGOI 2025

Правка en1, от alex_2008, 2025-04-17 17:00:47

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.

Теги graphs, strongly connected

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский alex_2008 2025-04-17 17:00:47 641 Initial revision (published)