CF1386C.Joker

省选/NOI-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Joker returns to Gotham City to execute another evil plan. In Gotham City, there are NN street junctions (numbered from 11 to NN) and MM streets (numbered from 11 to MM). Each street connects two distinct junctions, and two junctions are connected by at most one street.

For his evil plan, Joker needs to use an odd number of streets that together form a cycle. That is, for a junction SS and an even positive integer kk, there is a sequence of junctions S,s1,…,sk,SS, s_1, \ldots, s_k, S such that there are streets connecting (a) SS and s1s_1, (b) sks_k and SS, and (c) si−1s_{i-1} and sis_i for each i=2,…,ki = 2, \ldots, k.

However, the police are controlling the streets of Gotham City. On each day ii, they monitor a different subset of all streets with consecutive numbers jj: li≤j≤ril_i \leq j \leq r_i. These monitored streets cannot be a part of Joker's plan, of course. Unfortunately for the police, Joker has spies within the Gotham City Police Department; they tell him which streets are monitored on which day. Now Joker wants to find out, for some given number of days, whether he can execute his evil plan. On such a day there must be a cycle of streets, consisting of an odd number of streets which are not monitored on that day.

小丑重返哥谭市,准备实施另一项邪恶计划。在哥谭市中,共有 NN 个路口(编号为 11 至 NN)和 MM 条街道(编号为 11 至 MM)。每条街道连接两个不同的路口,且任意两个路口之间至多由一条街道相连。

为实施其邪恶计划,小丑需要使用奇数条街道构成一个环路。即:对某个起点路口 SS 和某个正偶数 kk,存在一串路口序列 S,s1,…,sk,SS, s_1, \ldots, s_k, S,使得存在街道分别连接:(a) SS 与 s1s_1;(b) sks_k 与 SS;(c) 对每个 i=2,…,ki = 2, \ldots, k,连接 si−1s_{i-1} 与 sis_i。

然而,哥谭市警察正在监控该市的街道。在第 ii 天,他们监控所有编号在区间 [li,ri][l_i, r_i] 内的街道(即编号连续的街道子集)。这些被监控的街道自然无法被小丑用于其计划。不幸的是,对于警方而言,小丑在哥谭市警察局内部安插了间谍;这些间谍会向他透露每天哪些街道被监控。现在,小丑希望判断:在给定的若干天中,是否存在某一天,使得当天未被监控的街道中存在一个由奇数条街道构成的环路。

输入格式

The first line of the input contains three integers NN, MM, and QQ (1≤N,M,Q≤200 0001 \leq N, M, Q \leq 200\,000): the number of junctions, the number of streets, and the number of days to be investigated. The following MM lines describe the streets. The jj-th of these lines (1≤j≤M1 \le j \le M) contains two junction numbers uu and vv (u≠vu \neq v), saying that street jj connects these two junctions. It is guaranteed that any two junctions are connected by at most one street. The following QQ lines contain two integers lil_i and rir_i, saying that all streets jj with li≤j≤ril_i \leq j \leq r_i are checked by the police on day ii (1≤i≤Q1 \leq i \leq Q).

输入的第一行包含三个整数 NN、MM 和 QQ(1≤N,M,Q≤200 0001 \leq N, M, Q \leq 200\,000):分别表示路口数量、街道数量以及需要调查的天数。接下来的 MM 行描述街道信息。其中第 jj 行(1≤j≤M1 \le j \le M)包含两个路口编号 uu 和 vv(u≠vu \neq v),表示第 jj 条街道连接这两个路口。保证任意两个路口之间至多只有一条街道相连。随后的 QQ 行每行包含两个整数 lil_i 和 rir_i,表示在第 ii 天(1≤i≤Q1 \leq i \leq Q),警方将检查所有满足 li≤j≤ril_i \leq j \leq r_i 的街道 jj。

输出格式

Your output is to contain QQ lines. Line ii (1≤i≤Q1 \leq i \leq Q) contains "YES" if Joker can execute his plan on day ii, or "NO" otherwise.

你的输出应包含 QQ 行。第 ii 行(1≤i≤Q1 \leq i \leq Q)在小丑能在第 ii 天执行其计划时输出 “YES”,否则输出 “NO”。

输入输出样例

  • 输入#1

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

    输出#1

    NO
    YES

说明/提示

The graph in the example test:

示例测试中的图:

输入解题思路,AI测评打分。不知道怎么写?

首页