当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7171:Range Reachability Query

题目描述
You are given a directed acyclic graph with $n$ vertices and $m$ edges. The vertices are labeled by $1,2,\dots,n$, and the edges are labeled by $1,2,\dots,m$.

You will be given $q$ queries. In the $i$-th query, you will be given four integers $u_i$, $v_i$, $l_i$ and $r_i$ ($1\leq l_i\leq r_i\leq m$). You need to answer whether vertex $u_i$ can reach vertex $v_i$ when only edges labeled by $k$ ($l_i\leq k\leq r_i$) are available.
输入解释
The first line contains a single integer $T$ ($1 \leq T \leq 10$), the number of test cases. For each test case:

The first line contains three integers $n,m$ and $q$ ($2 \leq n \leq 50\,000$, $1\leq m\leq 100\,000$, $1\leq q\leq 50\,000$), denoting the number of vertices, the number of edges, and the number of queries.

Each of the following $m$ lines contains two integers $u_i$ and $v_i$ ($1\leq u_i < v_i\leq n$), denoting a directed edge from vertex $u_i$ to vertex $v_i$.

In the next $q$ lines, the $i$-th line contains four integers $u_i$, $v_i$, $l_i$ and $r_i$ ($1\leq u_i < v_i\leq n$, $1\leq l_i\leq r_i\leq m$), describing the $i$-th query.
输出解释
For each query, print a single line. If vertex $u_i$ can reach vertex $v_i$ when only edges labeled by $k$ ($l_i\leq k\leq r_i$) are available, print ''$\texttt{YES}$''. Otherwise, print ''$\texttt{NO}$''.
输入样例
1
5 6 5
1 2
1 3
3 4
2 4
2 5
3 5
3 5 1 5
3 5 1 6
1 4 1 6
1 4 2 3
1 4 4 5
输出样例
NO
YES
YES
YES
NO

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7171

最后修改于 2022-09-15T06:17:09+00:00 由爬虫自动更新

共提交 1

通过率 0.0%
时间上限 内存上限
10000/10000MS(Java/Others) 524288/524288K(Java/Others)