CF1080F.Katya and Segments Sets
提高+/省选-
通过率:0%
时间限制:3.50s
内存限制:512MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
It is a very important day for Katya. She has a test in a programming class. As always, she was given an interesting problem that she solved very fast. Can you solve that problem?
You are given n ordered segments sets. Each segment can be represented as a pair of two integers [l,r] where l≤r. Each set can contain an arbitrary number of segments (even 0). It is possible that some segments are equal.
You are also given m queries, each of them can be represented as four numbers: a,b,x,y. For each segment, find out whether it is true that each set p (a≤p≤b) contains at least one segment [l,r] that lies entirely on the segment [x,y], that is x≤l≤r≤y.
Find out the answer to each query.
Note that you need to solve this problem online. That is, you will get a new query only after you print the answer for the previous query.
今天对卡佳来说是非常重要的一天。她正在参加一门编程课的测验。和往常一样,她被给出了一道有趣的题目,并且很快就解决了它。你能解决这道题吗?
你将得到 n 组有序的线段集合。每条线段可表示为一对整数 [l,r],其中 l≤r。每个集合可以包含任意数量的线段(甚至可以为 0)。某些线段可能完全相同。
此外,你还得到 m 个查询,每个查询由四个整数 a,b,x,y 表示。对于每个查询,请判断:是否对每个集合 p(满足 a≤p≤b),该集合中都至少存在一条线段 [l,r],使得该线段完全落在区间 [x,y] 内,即满足 x≤l≤r≤y。
请依次输出每个查询的答案。
注意:你需要在线解决此问题。也就是说,只有在你输出了前一个查询的答案之后,才会收到下一个查询。
输入格式
The first line contains three integers n, m, and k (1≤n,m≤105,1≤k≤3⋅105) — the number of sets, queries, and segments respectively.
Each of the next k lines contains three integers l, r, and p (1≤l≤r≤109,1≤p≤n) — the limits of the segment and the index of a set, to which this segment belongs.
Each of the next m lines contains four integers a,b,x,y (1≤a≤b≤n,1≤x≤y≤109) — the description of the query.
第一行包含三个整数 n、m 和 k(1≤n,m≤105,1≤k≤3⋅105)——分别表示集合的数量、查询的数量以及线段的数量。
接下来的 k 行,每行包含三个整数 l、r 和 p(1≤l≤r≤109,1≤p≤n)——分别表示该线段的左右端点及其所属集合的编号。
接下来的 m 行,每行包含四个整数 a、b、x、y(1≤a≤b≤n,1≤x≤y≤109)——表示一次查询的描述。
输出格式
For each query, print "yes" or "no" in a new line.
对于每个查询,在新行中输出 “yes” 或 “no”。
输入输出样例
输入#1
5 5 9 3 6 3 1 3 1 2 4 2 1 2 3 4 6 5 2 5 3 7 9 4 2 3 1 4 10 4 1 2 2 3 1 2 2 4 1 3 1 5 2 3 3 6 2 4 2 9
输出#1
no yes yes no yes
说明/提示
For the first query, the answer is negative since the second set does not contain a segment that lies on the segment [2,3].
In the second query, the first set contains [2,3], and the second set contains [2,4].
In the third query, the first set contains [2,3], the second set contains [2,4], and the third set contains [2,5].
In the fourth query, the second set does not contain a segment that lies on the segment [3,6].
In the fifth query, the second set contains [2,4], the third set contains [2,5], and the fourth contains [7,9].
对于第一个查询,答案是否定的,因为第二个集合不包含位于线段 [2,3] 上的任何线段。
在第二个查询中,第一个集合包含 [2,3],第二个集合包含 [2,4]。
在第三个查询中,第一个集合包含 [2,3],第二个集合包含 [2,4],第三个集合包含 [2,5]。
在第四个查询中,第二个集合不包含位于线段 [3,6] 上的任何线段。
在第五个查询中,第二个集合包含 [2,4],第三个集合包含 [2,5],第四个集合包含 [7,9]。
输入解题思路,AI测评打分。不知道怎么写?