Codeforces Round #419 (Div. 2)Karen and Coffee
来源:互联网 发布:软横跨计算软件 编辑:程序博客网 时间:2024/06/04 23:32
#include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>#include <queue>#include <vector>#include <stack>typedef long long LL;using namespace std;const int MAX = 200000+10;const int INF = 11234567;void Read(int &x) { char c; while(c=getchar(),c!=EOF) if(c>='0'&&c<='9') { x=c-'0'; while(c=getchar(),c>='0'&&c<='9') x=x*10+c-'0'; ungetc(c,stdin); return; }}int n, k, q, l, r, p[MAX], pp[MAX];int main() { scanf("%d%d%d", &n, &k, &q); for(int i = 0; i<n; ++i){ scanf("%d%d", &l, &r); p[l]++; p[r+1]--; } pp[0] =0 ; int kk = 0; for(int i = 1; i<=200000; ++i){ kk+=p[i]; if(kk>=k)pp[i] = pp[i-1]+1; else pp[i] = pp[i-1]; } for(int i = 0; i<q; ++i){ scanf("%d%d", &l, &r); printf("%d\n", pp[r]-pp[l-1]); } return 0;}
阅读全文
0 0
- Codeforces Round #419 (Div. 2)Karen and Coffee
- Codeforces Round #419 (Div. 2) B. Karen and Coffee
- Codeforces Round #419 (Div. 2)Karen and Coffee
- Codeforces Round #419 (Div. 2) B. Karen and Coffee 预处理+技巧
- [前缀和] Codeforces Round #419 (Div. 2)B. Karen and Coffee
- Codeforces Round #419 (Div. 2) B. Karen and Coffee (差分标记)
- Codeforces Round #419 (Div. 2) B. Karen and Coffee【前缀和求区间覆盖次数】
- Codeforces#419 Karen and Coffee
- Karen and Coffee codeforces
- CodeForces #419 Div.2 B Karen and Coffee 差分 巧妙
- Codeforces Round #419 (Div. 2) C.Karen and Game 思维
- Codeforces Round #419 (Div. 2)Karen and Game
- Codeforces Round #419 (Div. 2) C. Karen and Game 题解
- Codeforces Round #419 (Div. 2) A. Karen and Morning
- Codeforces Round #419 (Div. 2) C. Karen and Game【贪心】
- Codeforces Round #419 (Div. 2)_Karen and Coffee
- CodeForces B. Karen and Coffee
- Codeforces Round #419 (Div. 2) (Codeforces 815B) D. Karen and Test 组合数学
- afnetworking 3.0 How to POST with headers and HTTP Body
- EffectiveC++学习笔记-条款9
- codeforces712
- 你所不知道的AWS 云服务清单(71种)
- 【Unity光照系统】之实时和烘焙光照
- Codeforces Round #419 (Div. 2)Karen and Coffee
- 非凸问题与凸问题求解
- 为什么使用 Linux 和开源软件?
- 【Machine Learning】使用随机森林进行特征选择
- Spring注入值到bean四中方式
- could not find the main class : program will exit解决方案
- 内容提供者
- [sicily] 1003. 相连的1
- JSP状态管理