QOJ.ac

QOJ

حد الوقت: 7.0 s حد الذاكرة: 1024 MB مجموع النقاط: 100 قابلة للهجوم ✓

#15482. The Great Bubble Bridge Network

الإحصائيات

泡泡王国(Bubble Kingdom)曾经是一个分布在广阔泡泡海(Bubble Sea)上的由 $N$ 个城市组成的群岛。几个世纪以来,泡泡工程师们在这些城市之间建造了 $M$ 个桥梁,构建了一个连接它们的宏伟网络。然而,每座桥都有自己的奇特之处——有些桥只能维持几年,而有些桥只能承受有限的重量。随着时间的推移,许多古老的桥梁年久失修,让历史学家和冒险家们对泡泡王国交通系统在历史任何特定时间点的真实状态感到困惑。

你的任务是解开泡泡王国古老桥梁网络的谜团。你将获得一份曾经连接这些城市的桥梁的历史记录。每条记录详细说明了由一座双向桥梁连接的城市、该桥梁运营的年份以及它能承受的最大重量。现在,作为一名充满好奇心的冒险家,你必须回答 $Q$ 个问题:在给定你可靠的泡泡货车(Bubble Wagon)重量的情况下,在特定年份两个城市之间是否可以通行。

输入格式

第一行包含三个整数 $N$、$M$ 和 $Q$:分别表示城市数量、桥梁记录数量和询问数量($2 \le N \le 5 \cdot 10^4$,$1 \le M, Q \le 10^5$)。

接下来的 $M$ 行,每行包含五个整数:$U$、$V$、$W$、$Y_1$ 和 $Y_2$($1 \le U, V \le N$,$U \ne V$,$1 \le W \le 10^9$,$1 \le Y_1 \le Y_2 \le 10^9$)。它们表示在城市 $U$ 和城市 $V$ 之间存在一座桥梁,存在时间为从年份 $Y_1$ 到年份 $Y_2$(均包含),且最多可承载 $W$ 的重量。

接下来的 $Q$ 行,每行包含四个整数:$U$、$V$、$W$ 和 $Y$($1 \le U, V \le N$,$U \ne V$,$1 \le W \le 10^9$,$1 \le Y \le 10^9$)。它们表示你需要确定一辆重量为 $W$ 的泡泡货车是否能在年份 $Y$ 期间从城市 $U$ 旅行到城市 $V$。

输出格式

对于每个询问,输出一行答案:如果可以通行,输出 "Yes";否则输出 "No"。

样例

输入样例 1

4 5 5
1 2 5 1 3
1 2 10 3 5
1 3 6 1 2
2 3 8 2 5
2 4 7 2 3
1 4 6 2
1 3 8 5
3 4 8 3
1 2 10 2
2 3 5 1

输出样例 1

Yes
Yes
No
No
Yes

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.