CF816B.Karen and Coffee

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

To stay woke and attentive during classes, Karen needs some coffee!

Karen, a coffee aficionado, wants to know the optimal temperature for brewing the perfect cup of coffee. Indeed, she has spent some time reading several recipe books, including the universally acclaimed "The Art of the Covfefe".

She knows nn coffee recipes. The ii -th recipe suggests that coffee should be brewed between lil_{i} and rir_{i} degrees, inclusive, to achieve the optimal taste.

Karen thinks that a temperature is admissible if at least kk recipes recommend it.

Karen has a rather fickle mind, and so she asks qq questions. In each question, given that she only wants to prepare coffee with a temperature between aa and bb , inclusive, can you tell her how many admissible integer temperatures fall within the range?

输入格式

The first line of input contains three integers, nn , kk ( 1<=k<=n<=2000001<=k<=n<=200000 ), and qq ( 1<=q<=2000001<=q<=200000 ), the number of recipes, the minimum number of recipes a certain temperature must be recommended by to be admissible, and the number of questions Karen has, respectively.

The next nn lines describe the recipes. Specifically, the ii -th line among these contains two integers lil_{i} and rir_{i} ( 1<=li<=ri<=2000001<=l_{i}<=r_{i}<=200000 ), describing that the ii -th recipe suggests that the coffee be brewed between lil_{i} and rir_{i} degrees, inclusive.

The next qq lines describe the questions. Each of these lines contains aa and bb , ( 1<=a<=b<=2000001<=a<=b<=200000 ), describing that she wants to know the number of admissible integer temperatures between aa and bb degrees, inclusive.

输出格式

For each question, output a single integer on a line by itself, the number of admissible integer temperatures between aa and bb degrees, inclusive.

输入输出样例

  • 输入#1

    3 2 4
    91 94
    92 97
    97 99
    92 94
    93 97
    95 96
    90 100
    

    输出#1

    3
    3
    0
    4
    
  • 输入#2

    2 1 1
    1 1
    200000 200000
    90 100
    

    输出#2

    0
    

说明/提示

In the first test case, Karen knows 33 recipes.

  1. The first one recommends brewing the coffee between 9191 and 9494 degrees, inclusive.
  2. The second one recommends brewing the coffee between 9292 and 9797 degrees, inclusive.
  3. The third one recommends brewing the coffee between 9797 and 9999 degrees, inclusive.

A temperature is admissible if at least 22 recipes recommend it.

She asks 44 questions.

In her first question, she wants to know the number of admissible integer temperatures between 9292 and 9494 degrees, inclusive. There are 33 : 9292 , 9393 and 9494 degrees are all admissible.

In her second question, she wants to know the number of admissible integer temperatures between 9393 and 9797 degrees, inclusive. There are 33 : 9393 , 9494 and 9797 degrees are all admissible.

In her third question, she wants to know the number of admissible integer temperatures between 9595 and 9696 degrees, inclusive. There are none.

In her final question, she wants to know the number of admissible integer temperatures between 9090 and 100100 degrees, inclusive. There are 44 : 9292 , 9393 , 9494 and 9797 degrees are all admissible.

In the second test case, Karen knows 22 recipes.

  1. The first one, "wikiHow to make Cold Brew Coffee", recommends brewing the coffee at exactly 11 degree.
  2. The second one, "What good is coffee that isn't brewed at at least 36.330636.3306 times the temperature of the surface of the sun?", recommends brewing the coffee at exactly 200000200000 degrees.

A temperature is admissible if at least 11 recipe recommends it.

In her first and only question, she wants to know the number of admissible integer temperatures that are actually reasonable. There are none.

首页